gdm r6731 - in branches/gnome-2-20: . gui/modules



Author: bcameron
Date: Wed Feb 25 01:15:08 2009
New Revision: 6731
URL: http://svn.gnome.org/viewvc/gdm?rev=6731&view=rev

Log:
2009-02-24 Brian Cameron <brian cameron sun com>

        * gui/modules/keymouselistener.c: Using Xorg 1.5, the parse_line
          function can fail to set the keycode if XKB is not initialized
          when gdmlogin starts.  This fix causes GDM to check if the keycode
          failed to be initialized on keypress.  If so, it sets it and
          addresses the problem.


Modified:
   branches/gnome-2-20/ChangeLog
   branches/gnome-2-20/gui/modules/keymouselistener.c

Modified: branches/gnome-2-20/gui/modules/keymouselistener.c
==============================================================================
--- branches/gnome-2-20/gui/modules/keymouselistener.c	(original)
+++ branches/gnome-2-20/gui/modules/keymouselistener.c	Wed Feb 25 01:15:08 2009
@@ -364,8 +364,9 @@
 	gint    button = 0;
 	
 	if (!display) {
-		if ((display = gdk_display_get_default()) == NULL)
+		if ((display = gdk_display_get_default()) == NULL) {
 			return NULL;
+		}
 	}
 	lineno++;
 
@@ -578,11 +579,34 @@
 static gint
 key_gesture_compare_func (gconstpointer a, gconstpointer b)
 {
-	const Gesture *gesture = a;
-	const XEvent  *xev     = b;
+	Gesture *gesture   = a;
+	const XEvent  *xev = b;
 
 	if (gesture->type == GESTURE_TYPE_KEY) 
 	{
+	    /*
+	     * Using some Xservers, the parse_line function fails to get the
+	     * keycode because XKB is not initialized when gdmlogin starts.
+	     * If the keycode value is 0, try to set it again.
+	     */
+	    if (gesture->input.key.keycode == 0) {
+		static GdkDisplay *display = NULL;
+
+		if (!display)
+		    display = gdk_display_get_default();
+
+		if (display) {
+		    gesture->input.key.keycode =
+			XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (display),
+			gesture->input.key.keysym);
+
+		    if (debug_gestures)
+			syslog (LOG_WARNING, "Reset keycode to a real value");
+		} else if (debug_gestures) {
+		   syslog (LOG_WARNING, "Failed to reset keycode to a real value");
+		}
+	    }
+
 	    if (((xev->type == KeyPress) || (xev->type == KeyRelease)) &&
 		(xev->xkey.keycode == gesture->input.key.keycode) &&
 		((xev->xkey.state & USED_MODS) == gesture->input.key.state))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]