[metacity/f14] Add upstream patch to allow keybindings ungrab

Daniel Drake dsd at fedoraproject.org
Mon May 30 11:59:22 UTC 2011


commit 12a7eceefa8df289216199ede16f5f0a2382b908
Author: Daniel Drake <dsd at laptop.org>
Date:   Sun May 22 11:53:43 2011 +0100

    Add upstream patch to allow keybindings ungrab
    
    Needed for Sugar: http://dev.laptop.org/ticket/10693
    
    OK'd for F16 inclusion by Colin Walters

 allow-keybindings-ungrab.patch |   80 ++++++++++++++++++++++++++++++++++++++++
 metacity.spec                  |   12 +++++-
 2 files changed, 91 insertions(+), 1 deletions(-)
---
diff --git a/allow-keybindings-ungrab.patch b/allow-keybindings-ungrab.patch
new file mode 100644
index 0000000..25d82aa
--- /dev/null
+++ b/allow-keybindings-ungrab.patch
@@ -0,0 +1,80 @@
+From 429b200aa0e21b33a720790d18e059491eb60089 Mon Sep 17 00:00:00 2001
+From: Daniel Drake <dsd at laptop.org>
+Date: Wed, 02 Mar 2011 15:52:53 +0000
+Subject: Disable keybindings message should ungrab keys
+
+The disable-keybindings action is currently only 'soft' in that it
+just causes Metacity to ignore keypresses; the keys themselves are left
+bound.
+
+Sugar would like to use this message to actually disable the bindings
+*and* release the grabs so that it can implement its own Alt-Tab handler.
+
+This patch implements this. Based on earlier work by Bernie Innocenti.
+---
+diff --git a/src/core/display.c b/src/core/display.c
+index 518b4f3..3143e0c 100644
+--- a/src/core/display.c
++++ b/src/core/display.c
+@@ -2268,7 +2268,7 @@ event_callback (XEvent   *event,
+                 {
+                   meta_verbose ("Received set keybindings request = %d\n",
+                                 (int) event->xclient.data.l[0]);
+-                  meta_set_keybindings_disabled (!event->xclient.data.l[0]);
++                  meta_set_keybindings_disabled (display, !event->xclient.data.l[0]);
+                 }
+               else if (event->xclient.message_type ==
+                        display->atom__METACITY_TOGGLE_VERBOSE)
+diff --git a/src/core/keybindings.c b/src/core/keybindings.c
+index 8ea6b41..da274e0 100644
+--- a/src/core/keybindings.c
++++ b/src/core/keybindings.c
+@@ -817,6 +817,9 @@ meta_screen_grab_keys (MetaScreen *screen)
+   if (screen->keys_grabbed)
+     return;
+ 
++  if (all_bindings_disabled)
++    return;
++
+   grab_keys (screen->display->key_bindings,
+              screen->display->n_key_bindings,
+              screen->display, screen->xroot,
+@@ -841,6 +844,9 @@ meta_window_grab_keys (MetaWindow  *window)
+   if (window->all_keys_grabbed)
+     return;
+ 
++  if (all_bindings_disabled)
++    return;
++
+   if (window->type == META_WINDOW_DOCK)
+     {
+       if (window->keys_grabbed)
+@@ -3356,9 +3362,11 @@ handle_set_spew_mark (MetaDisplay    *display,
+ }
+ 
+ void
+-meta_set_keybindings_disabled (gboolean setting)
++meta_set_keybindings_disabled (MetaDisplay *display,
++                               gboolean     setting)
+ {
+   all_bindings_disabled = setting;
++  regrab_key_bindings (display);
+   meta_topic (META_DEBUG_KEYBINDINGS,
+               "Keybindings %s\n", all_bindings_disabled ? "disabled" : "enabled");
+ }
+diff --git a/src/core/keybindings.h b/src/core/keybindings.h
+index 618520b..f845b48 100644
+--- a/src/core/keybindings.h
++++ b/src/core/keybindings.h
+@@ -49,7 +49,8 @@ void     meta_window_ungrab_all_keys        (MetaWindow  *window,
+ void     meta_display_process_key_event     (MetaDisplay *display,
+                                              MetaWindow  *window,
+                                              XEvent      *event);
+-void     meta_set_keybindings_disabled      (gboolean     setting);
++void     meta_set_keybindings_disabled      (MetaDisplay *display,
++                                             gboolean     setting);
+ void     meta_display_process_mapping_event (MetaDisplay *display,
+                                              XEvent      *event);
+ 
+--
+cgit v0.9
diff --git a/metacity.spec b/metacity.spec
index 621b5c6..0511521 100644
--- a/metacity.spec
+++ b/metacity.spec
@@ -3,7 +3,7 @@
 Summary: Unobtrusive window manager
 Name: metacity
 Version: 2.30.3
-Release: 1%{?dist}
+Release: 2%{?dist}
 URL: http://download.gnome.org/sources/metacity/
 Source0: http://download.gnome.org/sources/metacity/2.30/metacity-%{version}.tar.bz2
 # http://bugzilla.gnome.org/show_bug.cgi?id=558723
@@ -44,6 +44,11 @@ Patch29: Allow-breaking-out-from-maximization-during-mouse.patch
 
 # default window icon: https://bugzilla.gnome.org/show_bug.cgi?id=616246
 Patch30: default-window-icon.patch
+
+# allow keybindings ungrab: https://bugzilla.gnome.org/show_bug.cgi?id=643682
+# already upstream
+Patch31: allow-keybindings-ungrab.patch
+
 Source1: window.png
 Source2: mini-window.png
 
@@ -129,6 +134,8 @@ API. This package exists purely for technical reasons.
 %patch29 -p1 -b .mouse-unmaximize
 
 %patch30 -p1 -b .window-icon
+%patch31 -p1 -b .keybindings-ungrab
+
 cp %{SOURCE1} %{SOURCE2} src/
 
 # force regeneration
@@ -237,6 +244,9 @@ fi
 %{_mandir}/man1/metacity-window-demo.1.gz
 
 %changelog
+* Mon May 30 2011 Daniel Drake <dsd at laptop.org> - 2.30.3-2
+- Add upstream patch to allow keybindings ungrab, needed for Sugar
+
 * Thu Sep 30 2010 Matthias Clasen <mclasen at redhat.com> - 2.30.3-1
 - Uupdate to 2.30.3
 


More information about the scm-commits mailing list