[gtk+] cellrendereraccel: don't translate Alt+Print to SysRq



commit 295ed0033e813796b73e8f5789ae7112d1302cb1
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Feb 28 15:36:32 2012 -0500

    cellrendereraccel: don't translate Alt+Print to SysRq
    
    We want to use Alt+Print for screenshot keybindings, so we have to avoid
    translating it into SysRq, since that's what the keymap would dictate.
    After talking with Owen, it sounds like doing this generically would be
    a lot of work and quite hairy code, so hardcoding this should be OK.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671006

 gtk/gtkcellrendereraccel.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcellrendereraccel.c b/gtk/gtkcellrendereraccel.c
index 10758f6..385c561 100644
--- a/gtk/gtkcellrendereraccel.c
+++ b/gtk/gtkcellrendereraccel.c
@@ -452,12 +452,24 @@ grab_key_callback (GtkWidget            *widget,
 
   accel_mods = event->state;
 
-  _gtk_translate_keyboard_accel_state (gdk_keymap_get_for_display (display),
-                                       event->hardware_keycode,
-                                       event->state,
-                                       gtk_accelerator_get_default_mod_mask (),
-                                       event->group,
-                                       &keyval, NULL, NULL, &consumed_modifiers);
+  if (event->keyval == GDK_KEY_Sys_Req && 
+      (accel_mods & GDK_MOD1_MASK) != 0)
+    {
+      /* HACK: we don't want to use SysRq as a keybinding (but we do
+       * want Alt+Print), so we avoid translation from Alt+Print to SysRq
+       */
+      keyval = GDK_KEY_Print;
+      consumed_modifiers = 0;
+    }
+  else
+    {
+      _gtk_translate_keyboard_accel_state (gdk_keymap_get_for_display (display),
+                                           event->hardware_keycode,
+                                           event->state,
+                                           gtk_accelerator_get_default_mod_mask (),
+                                           event->group,
+                                           &keyval, NULL, NULL, &consumed_modifiers);
+    }
 
   accel_key = gdk_keyval_to_lower (keyval);
   if (accel_key == GDK_KEY_ISO_Left_Tab) 



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