Merge lp://qastaging/~bratsche/xsplash/composite-overlay-hack into lp://qastaging/xsplash

Proposed by Cody Russell
Status: Merged
Approved by: Cody Russell
Approved revision: 46
Merge reported by: Cody Russell
Merged at revision: not available
Proposed branch: lp://qastaging/~bratsche/xsplash/composite-overlay-hack
Merge into: lp://qastaging/xsplash
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~bratsche/xsplash/composite-overlay-hack
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Ted Gould (community) Approve
Review via email: mp+10422@code.qastaging.launchpad.net

Commit message

THOU SHALT NOT FLICKER!

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Looks okay to me. It make sense, but I'd have to say that I've never tried this before :) A little low level for me.

review: Approve
Revision history for this message
Cody Russell (bratsche) wrote :

Just to give a little bit of info:

what we're doing here is retrieving a reference to the X composite overlay window before we create the xsplash window, and then hanging onto that reference for the lifetime of xsplash.

What's currently happening is:
 1. xsplash starts
 2. xsplash creates its window
 3. compiz starts
 4. compiz acquires a reference to the X composite overlay window, which at this point gets mapped and covers xsplash
 5. flicker
 6. xsplash gets an expose event
 7. redirected to composite overlay window, and life resumes

So basically what this branch is doing is duplicating #4 in between #1 and #2, so that xsplash acquires a reference to the composite overlay window before it displays its window. Then when we get to #4 compiz acquires its reference to the composite overlay window, but it doesn't need to get mapped because xsplash already caused it to be mapped.

Revision history for this message
David Barth (dbarth) wrote :

I tested with compiz and can confirm that it does the trick. It also doesn't prevent xsplash from working in a non-composited environment.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xsplash.c'
2--- src/xsplash.c 2009-08-19 15:59:17 +0000
3+++ src/xsplash.c 2009-08-19 21:14:43 +0000
4@@ -23,6 +23,10 @@
5
6 #include <gtk/gtk.h>
7 #include <gdk/gdkkeysyms.h>
8+#include <gdk/gdkx.h>
9+
10+#include <X11/Xlib.h>
11+#include <X11/extensions/Xcomposite.h>
12
13 #include <dbus/dbus-glib.h>
14 #include <dbus/dbus-glib-bindings.h>
15@@ -52,6 +56,8 @@
16 DBusGConnection *system_bus;
17 DBusGProxy *bus_proxy;
18
19+ Window cow;
20+
21 gboolean nautilus_done;
22 gboolean panel_done;
23 };
24@@ -162,6 +168,9 @@
25 {
26 XsplashServerPrivate *priv = XSPLASH_SERVER_GET_PRIVATE (object);
27
28+ XCompositeReleaseOverlayWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
29+ GDK_DRAWABLE_XID (GDK_WINDOW_ROOT));
30+
31 g_object_unref (priv->throbber_pixbuf);
32 g_object_unref (priv->window);
33 }
34@@ -284,6 +293,9 @@
35 priv->system_bus = NULL;
36 priv->bus_proxy = NULL;
37
38+ priv->cow = XCompositeGetOverlayWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
39+ GDK_DRAWABLE_XID (gdk_get_default_root_window ()));
40+
41 priv->window = g_object_new (gtk_window_get_type (),
42 "name", "xsplash-window",
43 "type-hint", GDK_WINDOW_TYPE_HINT_DOCK,
44@@ -504,10 +516,17 @@
45 window_realized (GtkWidget *window,
46 gpointer user_data)
47 {
48+ XsplashServer *server = (XsplashServer *)user_data;
49+ XsplashServerPrivate *priv = XSPLASH_SERVER_GET_PRIVATE (server);
50 GdkCursor *cursor = gdk_cursor_new (GDK_BLANK_CURSOR);
51+
52 gdk_window_set_cursor (window->window,
53 cursor);
54 gdk_cursor_unref (cursor);
55+
56+ XCompositeRedirectWindow (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
57+ GDK_DRAWABLE_XID (priv->window->window),
58+ CompositeRedirectAutomatic);
59 }
60
61 gboolean

Subscribers

People subscribed via source and target branches