[Frugalware-git] gnometesting: gnome-session-2.91.91.3-2-i686 *added fix for check accelaration

bouleetbil bouleetbil at frogdev.info
Sun Mar 20 23:25:07 CET 2011


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=gnometesting.git;a=commitdiff;h=c74d899fb8959f94e937bc3b11d1ed6201e70ab9

commit c74d899fb8959f94e937bc3b11d1ed6201e70ab9
Author: bouleetbil <bouleetbil at frogdev.info>
Date:   Sun Mar 20 23:24:38 2011 +0100

gnome-session-2.91.91.3-2-i686
*added fix for check accelaration

diff --git a/source/gnome/gnome-session/FrugalBuild b/source/gnome/gnome-session/FrugalBuild
index 24304db..d4f0432 100644
--- a/source/gnome/gnome-session/FrugalBuild
+++ b/source/gnome/gnome-session/FrugalBuild
@@ -3,7 +3,7 @@

pkgname=gnome-session
pkgver=2.91.91.3
-pkgrel=1
+pkgrel=2
pkgdesc="GNOME session manager"
depends=('libxml2>=2.7.8' 'gnome-desktop>=2.91.91' 'polkit' 'upower' 'gconf-gtk'  'usermode' \
'dbus-glib>=0.76' 'gnome-control-center>=2.91.90' 'libnotify' 'gnome-keyring>=2.91.0' \
@@ -17,7 +17,9 @@ _F_gnome_glib="y"
_F_gnome_iconcache="y"
_F_gnome_desktop="y"
Finclude gnome gnome-scriptlet
+source=($source accelerated.diff)
Fconfopts="$Fconfopts --with-gtk=3.0"
-sha1sums=('06726ad72fb011a460b0eee5482fd49016e305fc')
+sha1sums=('06726ad72fb011a460b0eee5482fd49016e305fc' \
+          'c713e0e0327be4f7bcbb75021c26c1d0d38fea84')

# optimization OK
diff --git a/source/gnome/gnome-session/accelerated.diff b/source/gnome/gnome-session/accelerated.diff
new file mode 100644
index 0000000..a4d70fa
--- /dev/null
+++ b/source/gnome/gnome-session/accelerated.diff
@@ -0,0 +1,138 @@
+From ce2968402f20087cec2c5d9f4fc5eb7bbfb25903 Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Mon, 14 Mar 2011 13:22:00 +0000
+Subject: gnome-session-check-accelerated: Avoid double checking
+
+Add a mechanism to have a second gnome-session-check-accelerated
+instance wait until a first instance is done with the GL checks.
+This is meant to accomodate the situation where we run the check
+in the gdm login session, but the user quickly logs in, and
+gnome-session runs the check again.
+---
+diff --git a/tools/gnome-session-check-accelerated.c b/tools/gnome-session-check-accelerated.c
+index bd113df..2bd7993 100644
+--- a/tools/gnome-session-check-accelerated.c
++++ b/tools/gnome-session-check-accelerated.c
+@@ -29,6 +29,17 @@
+ #include <gdk/gdkx.h>
+ #include <X11/Xatom.h>
+
++/* Wait up to this long for a running check to finish */
++#define PROPERTY_CHANGE_TIMEOUT 5000
++
++/* Values used for the _GNOME_SESSION_ACCELERATED root window property */
++#define NO_ACCEL            0
++#define HAVE_ACCEL          1
++#define ACCEL_CHECK_RUNNING 2
++
++static Atom is_accelerated_atom;
++static gboolean property_changed;
++
+ static void
+ exit_1_message (const char *msg) G_GNUC_NORETURN;
+
+@@ -39,12 +50,57 @@ exit_1_message (const char *msg)
+   exit (1);
+ }
+
++static gboolean
++on_property_notify_timeout (gpointer data)
++{
++        gtk_main_quit ();
++        return FALSE;
++}
++
++static GdkFilterReturn
++property_notify_filter (GdkXEvent *xevent,
++                        GdkEvent  *event,
++                        gpointer   data)
++{
++        XPropertyEvent *ev = xevent;
++
++        if (ev->type == PropertyNotify && ev->atom == is_accelerated_atom) {
++                property_changed = TRUE;
++                gtk_main_quit ();
++        }
++
++        return GDK_FILTER_CONTINUE;
++}
++
++static gboolean
++wait_for_property_notify (void)
++{
++        GdkDisplay *display = NULL;
++        GdkScreen *screen;
++        GdkWindow *root;
++        Window rootwin;
++
++        property_changed = FALSE;
++
++        display = gdk_display_get_default ();
++        screen = gdk_display_get_default_screen (display);
++        root = gdk_screen_get_root_window (screen);
++        rootwin = gdk_x11_window_get_xid (root);
++
++        XSelectInput (GDK_DISPLAY_XDISPLAY (display), rootwin, PropertyChangeMask);
++        gdk_window_add_filter (root, property_notify_filter, NULL);
++        g_timeout_add (PROPERTY_CHANGE_TIMEOUT, on_property_notify_timeout, NULL);
++
++        gtk_main ();
++
++        return property_changed;
++}
++
+ int
+ main (int argc, char **argv)
+ {
+         GdkDisplay *display = NULL;
+         int estatus;
+-        Atom is_accelerated_atom;
+         char *child_argv[] = { LIBEXECDIR "/gnome-session-check-accelerated-helper", NULL };
+         Window rootwin;
+         glong is_accelerated;
+@@ -64,6 +120,7 @@ main (int argc, char **argv)
+                 gulong bytes_after;
+                 guchar *data;
+
++ read:
+                 gdk_x11_display_error_trap_push (display);
+                 XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), rootwin,
+                                     is_accelerated_atom,
+@@ -73,12 +130,31 @@ main (int argc, char **argv)
+
+                 if (type == XA_CARDINAL) {
+                         glong *is_accelerated_ptr = (glong*) data;
+-                        /* Exit 1 if the property is 0 (false) */
+-                        return (*is_accelerated_ptr == 0) ? 1 : 0;
++
++                        if (*is_accelerated_ptr == ACCEL_CHECK_RUNNING) {
++                                /* Test in progress, wait */
++                                if (wait_for_property_notify ())
++                                        goto read;
++                                /* else fall through and do the check ourselves */
++
++                        } else {
++                                return (*is_accelerated_ptr == 0 ? 1 : 0);
++                        }
+                 }
+         }
+
+-        /* We don't have the property or it's the wrong type.  Try to compute it now. */
++        /* We don't have the property or it's the wrong type.
++         * Try to compute it now.
++         */
++
++        /* First indicate that a test is in progress */
++        is_accelerated = ACCEL_CHECK_RUNNING;
++        XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
++                         rootwin,
++                         is_accelerated_atom,
++                         XA_CARDINAL, 32, PropModeReplace, (guchar *) &is_accelerated, 1);
++
++        gdk_display_sync (display);
+
+         estatus = 1;
+         if (!g_spawn_sync (NULL, (char**)child_argv, NULL, 0,
+--
+cgit v0.8.3.4
+


More information about the Frugalware-git mailing list