summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@math.utah.edu>2004-10-20 23:16:08 +0000
committerElijah Newren <newren@src.gnome.org>2004-10-20 23:16:08 +0000
commitccd4414a0f8891bad8fd56a819855d96bde403a1 (patch)
tree7418a7d59d096527f8d9447cc252e9e72f3283ce
parentadc578e32dceb165ac481d3ac878174899ee6453 (diff)
downloadmetacity-ccd4414a0f8891bad8fd56a819855d96bde403a1.tar.gz
Patch from Soeren to fix the modifier key breakage introduced by an Xorg
2004-10-20 Elijah Newren <newren@math.utah.edu> Patch from Soeren to fix the modifier key breakage introduced by an Xorg change. (fixes #151554) * src/keybindings.c: include X11/XKBlib.h if available, (handle_spew_mark): remove this unused function declaration, (end_keyboard_grab): new function, uses XKB if available, (process_tab_grab): use end_keyboard_grab to determine whether to end the grab, (error_on_command): make key a const char *, (process_workspace_switch_grab): use end_keyboard_grab to determine whether to end the grab
-rw-r--r--ChangeLog13
-rw-r--r--src/keybindings.c52
2 files changed, 51 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index bf7981d3..66802779 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-10-20 Elijah Newren <newren@math.utah.edu>
+
+ Patch from Soeren to fix the modifier key breakage introduced by
+ an Xorg change. (fixes #151554)
+
+ * src/keybindings.c: include X11/XKBlib.h if available,
+ (handle_spew_mark): remove this unused function declaration,
+ (end_keyboard_grab): new function, uses XKB if available,
+ (process_tab_grab): use end_keyboard_grab to determine whether to
+ end the grab, (error_on_command): make key a const char *,
+ (process_workspace_switch_grab): use end_keyboard_grab to
+ determine whether to end the grab
+
2004-10-19 Anders Carlsson <andersca@gnome.org>
* src/frame.c: (meta_window_ensure_frame):
diff --git a/src/keybindings.c b/src/keybindings.c
index c64fc605..3adb85f0 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -36,6 +36,10 @@
#include <stdio.h>
#include <stdlib.h>
+#ifdef HAVE_XKB
+#include <X11/XKBlib.h>
+#endif
+
static gboolean all_bindings_disabled = FALSE;
typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display,
@@ -191,12 +195,6 @@ static void handle_run_terminal (MetaDisplay *display,
MetaKeyBinding *binding);
/* debug */
-static void handle_spew_mark (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-
static gboolean process_keyboard_move_grab (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
@@ -2318,6 +2316,33 @@ process_keyboard_resize_grab (MetaDisplay *display,
}
static gboolean
+end_keyboard_grab (MetaDisplay *display,
+ unsigned int keycode)
+{
+#ifdef HAVE_XKB
+ if (display->xkb_base_event_type > 0)
+ {
+ unsigned int primary_modifier;
+ XkbStateRec state;
+
+ primary_modifier = get_primary_modifier (display, display->grab_mask);
+
+ XkbGetState (display->xdisplay, XkbUseCoreKbd, &state);
+
+ if (!(primary_modifier & state.mods))
+ return TRUE;
+ }
+ else
+#endif
+ {
+ if (keycode_is_primary_modifier (display, keycode, display->grab_mask))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
process_tab_grab (MetaDisplay *display,
MetaScreen *screen,
XEvent *event,
@@ -2332,10 +2357,9 @@ process_tab_grab (MetaDisplay *display,
return FALSE;
g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
-
+
if (event->type == KeyRelease &&
- keycode_is_primary_modifier (display, event->xkey.keycode,
- display->grab_mask))
+ end_keyboard_grab (display, event->xkey.keycode))
{
/* We're done, move to the new window. */
Window target_xwindow;
@@ -2510,7 +2534,7 @@ error_on_generic_command (const char *key,
argv[3] = "--timestamp";
argv[4] = timestampbuf;
argv[5] = "--command-failed-error";
- argv[6] = key;
+ argv[6] = (char *)key;
argv[7] = (char*) (command ? command : "");
argv[8] = (char*) message;
argv[9] = NULL;
@@ -2552,12 +2576,13 @@ error_on_command (int command_index,
g_free (key);
}
+static void
error_on_terminal_command (const char *command,
const char *message,
int screen_number,
Time timestamp)
{
- char *key;
+ const char *key;
meta_warning ("Error on terminal command \"%s\": %s\n", command, message);
@@ -2689,10 +2714,9 @@ process_workspace_switch_grab (MetaDisplay *display,
return FALSE;
g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
-
+
if (event->type == KeyRelease &&
- keycode_is_primary_modifier (display, event->xkey.keycode,
- display->grab_mask))
+ end_keyboard_grab (display, event->xkey.keycode))
{
/* We're done, move to the new workspace. */
MetaWorkspace *target_workspace;