summaryrefslogtreecommitdiff
path: root/gtk/window-decorator/switcher.c
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-02-10 20:26:12 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-02-10 20:26:12 +0800
commit73499a21c1ec450eb70de8129185e0289f86d56f (patch)
tree53d4efe429ab403a205b0e5e3942cbefca362216 /gtk/window-decorator/switcher.c
parent561d030ab63f3888d1b7698a3c2a8c7ba8985b79 (diff)
downloadcompiz-with-glib-mainloop-73499a21c1ec450eb70de8129185e0289f86d56f.tar.gz
compiz-with-glib-mainloop-73499a21c1ec450eb70de8129185e0289f86d56f.tar.bz2
Make the switcher window being override redirect.
Previously the switcher window was a normal managed window (which the switcher plugin actually lied about, see SwitchWindow::managed), such that the decorators could pick it up and draw the switcher decoration. However now with reparenting, this means that whenever we actually manage and unmanage the switcher window (eg with map and unmap) it means we must also reparent the window, which floods the server with requests and makes the switcher slow. Since we don't interact with the switcher window, it makes no sense to manage it like this, so make it override redirect
Diffstat (limited to 'gtk/window-decorator/switcher.c')
-rw-r--r--gtk/window-decorator/switcher.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/gtk/window-decorator/switcher.c b/gtk/window-decorator/switcher.c
index 046ea0a..6da0475 100644
--- a/gtk/window-decorator/switcher.c
+++ b/gtk/window-decorator/switcher.c
@@ -257,20 +257,49 @@ draw_switcher_decoration (decor_t *d)
draw_switcher_foreground (d);
}
+void
+switcher_window_closed ()
+{
+ g_free (switcher_window);
+ switcher_window = NULL;
+}
+
+/* Switcher is override-redirect now, we need to track
+ * it separately */
+decor_t *
+switcher_window_opened (Window popup, Window window)
+{
+ decor_t *d;
+
+ d = switcher_window = calloc (1, sizeof (decor_t));
+ if (!d)
+ return NULL;
+
+ return d;
+}
+
+
gboolean
-update_switcher_window (WnckWindow *win,
+update_switcher_window (Window popup,
Window selected)
{
- decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
+ decor_t *d = switcher_window;
GdkPixmap *pixmap, *buffer_pixmap = NULL;
- gint height, width = 0;
+ unsigned int height, width = 0, border, depth;
+ int x, y;
+ Window root_return;
WnckWindow *selected_win;
Display *xdisplay;
XRenderPictFormat *format;
+ if (!d)
+ d = switcher_window_opened (popup, selected);
+
xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
- wnck_window_get_client_window_geometry (win, NULL, NULL, &width, NULL);
+ /* FIXME: Thats a round-trip */
+ XGetGeometry (gdk_x11_get_default_xdisplay (), popup, &root_return,
+ &x, &y, &width, &height, &border, &depth);
decor_get_default_layout (&switcher_context, width, 1, &d->border_layout);
@@ -419,7 +448,7 @@ update_switcher_window (WnckWindow *win,
d->width = width;
d->height = height;
- d->prop_xid = wnck_window_get_xid (win);
+ d->prop_xid = popup;
queue_decor_draw (d);