Bugzilla – Attachment 111038 Details for
Bug 217044
Win keys are hard binded to GNOME menu
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
Allow Super_L to post main menu without losing function as Mod4 to apply: 1.)untar fresh metacity-2.16.3.tar.bz2 2.)cd metacity-2.16.3 3.)patch -p0 < <path to patch file>
new-metacity-windows-key-binding.patch (text/plain), 9.96 KB, created by
Luke Myers
on 2006-12-25 22:35:35 UTC
(
hide
)
Description:
Allow Super_L to post main menu without losing function as Mod4 to apply: 1.)untar fresh metacity-2.16.3.tar.bz2 2.)cd metacity-2.16.3 3.)patch -p0 < <path to patch file>
Filename:
MIME Type:
Creator:
Luke Myers
Created:
2006-12-25 22:35:35 UTC
Size:
9.96 KB
patch
obsolete
>diff -Naur ./src/keybindings.c ../metacity-2.16.3.new/src/keybindings.c >--- ./src/keybindings.c 2006-09-18 10:27:22.000000000 -0700 >+++ ../metacity-2.16.3.new/src/keybindings.c 2006-12-25 11:37:36.000000000 -0700 >@@ -43,6 +43,9 @@ > > static gboolean all_bindings_disabled = FALSE; > >+/* This keycode, if set, will activate the main menu when released */ >+unsigned int main_menu_keycode = FALSE; >+ > typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display, > MetaScreen *screen, > MetaWindow *window, >@@ -195,6 +198,12 @@ > XEvent *event, > MetaKeyBinding *binding); > >+static void handle_panel_action (MetaDisplay *display, >+ MetaScreen *screen, >+ MetaWindow *window, >+ XEvent *event, >+ MetaKeyBindingAction action); >+ > /* debug */ > static gboolean process_mouse_move_resize_grab (MetaDisplay *display, > MetaScreen *screen, >@@ -881,6 +890,7 @@ > switch (pref) > { > case META_PREF_SCREEN_KEYBINDINGS: >+ case META_PREF_ENABLE_WINDOWS_KEYS: > rebuild_screen_binding_table (display); > reload_keycodes (display); > reload_modifiers (display); >@@ -1107,6 +1117,23 @@ > meta_error_trap_pop (display, FALSE); > } > >+/* Hardcoded keycodes for the Windows flag keys */ >+#define WINDOWS_KEY_1_KEYCODE 115 >+#define WINDOWS_KEY_2_KEYCODE 116 >+ >+static void >+meta_screen_grab_ungrab_windows_keys (MetaScreen *screen) >+{ >+ gboolean grab = meta_prefs_get_enable_windows_keys (); >+ >+ meta_error_trap_push (screen->display); >+ >+ meta_change_keygrab (screen->display, screen->xroot, grab, 0, WINDOWS_KEY_1_KEYCODE, 0); >+ meta_change_keygrab (screen->display, screen->xroot, grab, 0, WINDOWS_KEY_2_KEYCODE, 0); >+ >+ meta_error_trap_pop (screen->display, FALSE); >+} >+ > void > meta_screen_grab_keys (MetaScreen *screen) > { >@@ -1116,6 +1143,8 @@ > if (screen->keys_grabbed) > return; > >+ meta_screen_grab_ungrab_windows_keys (screen); >+ > grab_keys (screen->display->screen_bindings, > screen->display->n_screen_bindings, > screen->display, screen->xroot); >@@ -1539,7 +1568,7 @@ > /* we used to have release-based bindings but no longer. */ > if (event->type == KeyRelease) > return; >- >+ > i = 0; > while (i < n_bindings) > { >@@ -1636,6 +1665,33 @@ > all_keys_grabbed = window ? window->all_keys_grabbed : screen->all_keys_grabbed; > if (!all_keys_grabbed) > { >+ /* Handle the special action for the main menu. This binding provides >+ for a one-touch main menu while also leaving the key available for >+ use as a modifier */ >+ if (event->type == KeyPress >+ && meta_prefs_get_enable_windows_keys () >+ && (event->xkey.state & ~display->ignored_modifier_mask) == 0 >+ && (event->xkey.keycode == WINDOWS_KEY_1_KEYCODE >+ || event->xkey.keycode == WINDOWS_KEY_2_KEYCODE)) >+ >+ /* Record this key depressed in case main menu wanted */ >+ main_menu_keycode = event->xkey.keycode; >+ >+ else if (main_menu_keycode == FALSE) >+ /* No pending main menu event, just continue */; >+ >+ else if (event->xkey.keycode != main_menu_keycode) >+ /* An event, other than main_menu_keycode release, took place, >+ so cancel the pending menu event */ >+ main_menu_keycode = FALSE; >+ >+ else if (event->xkey.keycode == main_menu_keycode) >+ { >+ main_menu_keycode = FALSE; >+ handle_panel_action (display,screen, NULL, event, >+ META_KEYBINDING_ACTION_PANEL_MAIN_MENU); >+ } >+ > /* Do the normal keybindings */ > process_event (display->screen_bindings, > display->n_screen_bindings, >@@ -1649,7 +1705,7 @@ > display, screen, window, event, keysym); > > return; >- } >+ } > > if (display->grab_op == META_GRAB_OP_NONE) > return; >@@ -2955,18 +3011,15 @@ > } > > static void >-handle_panel_keybinding (MetaDisplay *display, >- MetaScreen *screen, >- MetaWindow *window, >- XEvent *event, >- MetaKeyBinding *binding) >+handle_panel_action (MetaDisplay *display, >+ MetaScreen *screen, >+ MetaWindow *window, >+ XEvent *event, >+ MetaKeyBindingAction action) > { >- MetaKeyBindingAction action; > Atom action_atom; > XClientMessageEvent ev; > >- action = GPOINTER_TO_INT (binding->handler->data); >- > action_atom = None; > switch (action) > { >@@ -3005,6 +3058,19 @@ > } > > static void >+handle_panel_keybinding (MetaDisplay *display, >+ MetaScreen *screen, >+ MetaWindow *window, >+ XEvent *event, >+ MetaKeyBinding *binding) >+{ >+ MetaKeyBindingAction action; >+ >+ action = GPOINTER_TO_INT (binding->handler->data); >+ handle_panel_action (display, screen, window, event, action); >+} >+ >+static void > handle_activate_menu (MetaDisplay *display, > MetaScreen *screen, > MetaWindow *event_window, >diff -Naur ./src/metacity.schemas.in ../metacity-2.16.3.new/src/metacity.schemas.in >--- ./src/metacity.schemas.in 2006-04-14 19:05:44.000000000 -0700 >+++ ../metacity-2.16.3.new/src/metacity.schemas.in 2006-12-25 11:28:56.000000000 -0700 >@@ -241,7 +241,7 @@ > <applyto>/apps/metacity/general/audible_bell</applyto> > <owner>metacity</owner> > <type>bool</type> >- <default>true</default> >+ <default>false</default> > <locale name="C"> > <short>System Bell is Audible</short> > <long> >@@ -335,6 +335,22 @@ > </locale> > </schema> > >+ >+ <schema> >+ <key>/schemas/apps/metacity/general/enable_windows_keys</key> >+ <applyto>/apps/metacity/general/enable_windows_keys</applyto> >+ <owner>metacity</owner> >+ <type>bool</type> >+ <default>true</default> >+ <locale name="C"> >+ <short>If true, enables the Windows flag keys to show the panel's main menu</short> >+ <long> >+ If true, then pressing the Windows flag keys will cause the panel's main >+ menu to appear. >+ </long> >+ </locale> >+ </schema> >+ > <!-- Window Keybindings --> > > <schema> >diff -Naur ./src/prefs.c ../metacity-2.16.3.new/src/prefs.c >--- ./src/prefs.c 2006-08-21 12:06:25.000000000 -0700 >+++ ../metacity-2.16.3.new/src/prefs.c 2006-12-25 10:17:11.000000000 -0700 >@@ -56,6 +56,7 @@ > #define KEY_BUTTON_LAYOUT "/apps/metacity/general/button_layout" > #define KEY_REDUCED_RESOURCES "/apps/metacity/general/reduced_resources" > #define KEY_GNOME_ACCESSIBILITY "/desktop/gnome/interface/accessibility" >+#define KEY_ENABLE_WINDOWS_KEYS "/apps/metacity/general/enable_windows_keys" > > #define KEY_COMMAND_PREFIX "/apps/metacity/keybinding_commands/command_" > >@@ -99,6 +100,7 @@ > static gboolean bell_is_audible = TRUE; > static gboolean reduced_resources = FALSE; > static gboolean gnome_accessibility = FALSE; >+static gboolean enable_windows_keys = TRUE; > static char *cursor_theme = NULL; > static int cursor_size = 24; > static gboolean compositing_manager = FALSE; >@@ -161,6 +163,7 @@ > const char *value); > static gboolean update_reduced_resources (gboolean value); > static gboolean update_gnome_accessibility (gboolean value); >+static gboolean update_enable_windows_keys (gboolean value); > static gboolean update_cursor_theme (const char *value); > static gboolean update_cursor_size (int size); > static gboolean update_compositing_manager (gboolean value); >@@ -496,6 +499,11 @@ > if (get_bool (KEY_GNOME_ACCESSIBILITY, &bool_val)) > update_gnome_accessibility (bool_val); > >+ bool_val = gconf_client_get_bool (default_client, KEY_ENABLE_WINDOWS_KEYS, >+ &err); >+ cleanup_error (&err); >+ update_enable_windows_keys (bool_val); >+ > str_val = gconf_client_get_string (default_client, KEY_CURSOR_THEME, > &err); > cleanup_error (&err); >@@ -1037,6 +1045,22 @@ > if (update_compositing_manager (b)) > queue_changed (META_PREF_COMPOSITING_MANAGER); > } >+ else if (strcmp (key, KEY_ENABLE_WINDOWS_KEYS) == 0) >+ { >+ gboolean b; >+ >+ if (value && value->type != GCONF_VALUE_BOOL) >+ { >+ meta_warning (_("GConf key \"%s\" is set to an invalid type\n"), >+ KEY_ENABLE_WINDOWS_KEYS); >+ goto out; >+ } >+ >+ b = value ? gconf_value_get_bool (value) : enable_windows_keys; >+ >+ if (update_enable_windows_keys (b)) >+ queue_changed (META_PREF_ENABLE_WINDOWS_KEYS); >+ } > else > { > meta_topic (META_DEBUG_PREFS, "Key %s doesn't mean anything to Metacity\n", >@@ -1577,6 +1601,16 @@ > > return old != disable_workarounds; > } >+ >+static gboolean >+update_enable_windows_keys (gboolean value) >+{ >+ gboolean old = enable_windows_keys; >+ >+ enable_windows_keys = value; >+ >+ return old != enable_windows_keys; >+} > #endif /* HAVE_GCONF */ > > gboolean >@@ -2846,6 +2880,12 @@ > } > > gboolean >+meta_prefs_get_enable_windows_keys (void) >+{ >+ return enable_windows_keys; >+} >+ >+gboolean > meta_prefs_get_gnome_accessibility () > { > return gnome_accessibility; >diff -Naur ./src/prefs.h ../metacity-2.16.3.new/src/prefs.h >--- ./src/prefs.h 2006-08-21 12:06:25.000000000 -0700 >+++ ../metacity-2.16.3.new/src/prefs.h 2006-12-25 10:17:11.000000000 -0700 >@@ -52,6 +52,7 @@ > META_PREF_VISUAL_BELL_TYPE, > META_PREF_REDUCED_RESOURCES, > META_PREF_GNOME_ACCESSIBILITY, >+ META_PREF_ENABLE_WINDOWS_KEYS, > META_PREF_CURSOR_THEME, > META_PREF_CURSOR_SIZE, > META_PREF_COMPOSITING_MANAGER >@@ -82,6 +83,7 @@ > int meta_prefs_get_auto_raise_delay (void); > gboolean meta_prefs_get_reduced_resources (void); > gboolean meta_prefs_get_gnome_accessibility (void); >+gboolean meta_prefs_get_enable_windows_keys (void); > > const char* meta_prefs_get_command (int i); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 217044
: 111038 |
122634