diff options
author | Brian Cameron <brian.cameron@sun.com> | 2009-02-25 01:15:08 +0000 |
---|---|---|
committer | Brian Cameron <bcameron@src.gnome.org> | 2009-02-25 01:15:08 +0000 |
commit | 1daa92bd73917d2b79be9bb4afc6903b1e9b994c (patch) | |
tree | e30ba3cdd123fdf9b6c19b06f6f43fda4bd0a3b6 | |
parent | 5e6e8eb08cf581be9783660818b45d5cbe76fd38 (diff) | |
download | gdm-1daa92bd73917d2b79be9bb4afc6903b1e9b994c.tar.gz |
Using Xorg 1.5, the parse_line function can fail to set the keycode if XKB
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.
svn path=/branches/gnome-2-20/; revision=6731
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gui/modules/keymouselistener.c | 30 |
2 files changed, 35 insertions, 3 deletions
@@ -1,3 +1,11 @@ +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. + 2009-02-11 Brian Cameron <brian.cameron@sun.com> * config/Makefile.am, config/Xsession.common, config/Xsession.in diff --git a/gui/modules/keymouselistener.c b/gui/modules/keymouselistener.c index 0229008e..8da234ab 100644 --- a/gui/modules/keymouselistener.c +++ b/gui/modules/keymouselistener.c @@ -364,8 +364,9 @@ parse_line (gchar *buf) 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 @@ keycodes_equal (XEvent *ev1, XEvent *ev2) 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)) |