~ubuntu-branches/ubuntu/trusty/gnome-do/trusty

« back to all changes in this revision

Viewing changes to debian/patches/03_fix_keybindings.diff

  • Committer: Package Import Robot
  • Author(s): Christopher James Halse Rogers
  • Date: 2012-03-26 11:12:21 UTC
  • mfrom: (0.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120326111221-1jk143fy37zxi3e4
Tags: 0.9-1
* New upstream version no longer uses deprecated internal glib headers.
  (Closes: #665537)
* [59fa37b9] Fix watch file
* [63486516] Imported Upstream version 0.9
* [8c636d84] Disable testsuite for now; requires running dbus and gconf daemons
* [e46de4b9] Remove inaccurate README.Source
* [4591d677] Add git-buildpackage configuration to default to pristine-tar

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
------------------------------------------------------------
2
 
revno: 1371
3
 
fixes bug: https://launchpad.net/bugs/903566
4
 
committer: Christopher James Halse Rogers <raof@ubuntu.com>
5
 
branch nick: trunk
6
 
timestamp: Sun 2012-02-05 21:43:22 +1100
7
 
message:
8
 
  Keybindings: Use KeyEventToString everywhere
9
 
  
10
 
  We had two different keybinding → string mappings happening: one when
11
 
  setting the keybinding in preferences, and one when processing keys.
12
 
  This could (and, indeed, does) result in summoning keybindings not
13
 
  working to unsummon.
14
 
  
15
 
  Also works around bug #903566.  A proper fix (possibly in GTK♯) should
16
 
  still be investigated.
17
 
modified:
18
 
  Do.Platform/src/Do.Platform/Do.Platform.Common/AbstractKeyBindingService.cs
19
 
  Do.Platform/src/Do.Platform/Do.Platform.Default/KeyBindingService.cs
20
 
  Do.Platform/src/Do.Platform/IKeyBindingService.cs
21
 
  Do/src/Do.Core/Controller.cs
22
 
  Do/src/Do.UI/KeybindingTreeView.cs
23
 
diff:
24
 
=== modified file 'Do.Platform/src/Do.Platform/Do.Platform.Common/AbstractKeyBindingService.cs'
25
 
Index: Do.Platform/src/Do.Platform/Do.Platform.Common/AbstractKeyBindingService.cs
26
 
===================================================================
27
 
--- Do.Platform/src/Do.Platform/Do.Platform.Common/AbstractKeyBindingService.cs.orig    2011-03-20 20:56:41.000000000 +1100
28
 
+++ Do.Platform/src/Do.Platform/Do.Platform.Common/AbstractKeyBindingService.cs 2012-03-18 21:06:19.956714068 +1100
29
 
@@ -107,25 +107,28 @@
30
 
                /// <returns>
31
 
                /// A <see cref="System.String"/> in the form "<Modifier>key"
32
 
                /// </returns>
33
 
-               public string KeyEventToString (Gdk.EventKey evnt) {
34
 
+               public string KeyEventToString (uint keycode, uint modifierCode) {
35
 
+                       // FIXME: This should really use Gtk.Accelerator.Name (key, modifier)
36
 
+                       // Beware of bug #903566 when doing that!
37
 
+
38
 
                        string modifier = "";
39
 
-                       if ((evnt.State & Gdk.ModifierType.ControlMask) != 0) {
40
 
+                       if ((modifierCode & (uint)Gdk.ModifierType.ControlMask) != 0) {
41
 
                                modifier += "<Control>";
42
 
                        }
43
 
-                       if ((evnt.State & Gdk.ModifierType.SuperMask) != 0) {
44
 
+                       if ((modifierCode & (uint)Gdk.ModifierType.SuperMask) != 0) {
45
 
                                modifier += "<Super>";
46
 
                        }
47
 
-                       if ((evnt.State & Gdk.ModifierType.Mod1Mask) != 0) {
48
 
+                       if ((modifierCode & (uint)Gdk.ModifierType.Mod1Mask) != 0) {
49
 
                                modifier += "<Alt>";
50
 
                        }
51
 
-                       if ((evnt.State & Gdk.ModifierType.ShiftMask) != 0) {
52
 
+                       if ((modifierCode & (uint)Gdk.ModifierType.ShiftMask) != 0) {
53
 
                                modifier += "<Shift>";
54
 
                                //if we're pressing shift, and the key is ISO_Left_Tab,
55
 
                                //just make it Tab
56
 
-                               if (evnt.Key == Gdk.Key.ISO_Left_Tab)
57
 
+                               if (keycode == (uint)Gdk.Key.ISO_Left_Tab)
58
 
                                        return string.Format ("{0}{1}", modifier, Gdk.Key.Tab);
59
 
                        }
60
 
-                       return string.Format ("{0}{1}", modifier, Gtk.Accelerator.Name (evnt.KeyValue, Gdk.ModifierType.None));
61
 
+                       return string.Format ("{0}{1}", modifier, Gtk.Accelerator.Name (keycode, Gdk.ModifierType.None));
62
 
                }
63
 
 #endregion
64
 
        }
65
 
Index: Do.Platform/src/Do.Platform/Do.Platform.Default/KeyBindingService.cs
66
 
===================================================================
67
 
--- Do.Platform/src/Do.Platform/Do.Platform.Default/KeyBindingService.cs.orig   2009-08-20 20:19:16.000000000 +1000
68
 
+++ Do.Platform/src/Do.Platform/Do.Platform.Default/KeyBindingService.cs        2012-03-18 21:02:51.200703571 +1100
69
 
@@ -16,7 +16,7 @@
70
 
                public bool SetKeyString (KeyBinding binding, string keyString) {
71
 
                        return false;
72
 
                }
73
 
-               public string KeyEventToString (Gdk.EventKey evnt) {
74
 
+               public string KeyEventToString (uint keycode, uint modifierCode) {
75
 
                        return "";
76
 
                }
77
 
                public List<KeyBinding> Bindings { get { return new List<KeyBinding> (); } }
78
 
Index: Do.Platform/src/Do.Platform/IKeyBindingService.cs
79
 
===================================================================
80
 
--- Do.Platform/src/Do.Platform/IKeyBindingService.cs.orig      2009-08-20 20:19:16.000000000 +1000
81
 
+++ Do.Platform/src/Do.Platform/IKeyBindingService.cs   2012-03-18 21:02:51.200703571 +1100
82
 
@@ -15,6 +15,6 @@
83
 
                bool RegisterKeyBinding (KeyBinding evnt);
84
 
                bool SetKeyString (KeyBinding binding, string keyString);
85
 
                List<KeyBinding> Bindings { get; }
86
 
-               string KeyEventToString (EventKey evnt);
87
 
+               string KeyEventToString (uint keycode, uint modifierCode);
88
 
        }
89
 
 }
90
 
Index: Do/src/Do.Core/Controller.cs
91
 
===================================================================
92
 
--- Do/src/Do.Core/Controller.cs.orig   2011-03-20 20:56:38.000000000 +1100
93
 
+++ Do/src/Do.Core/Controller.cs        2012-03-18 21:02:51.200703571 +1100
94
 
@@ -473,9 +473,9 @@
95
 
                        } else if (key == Key.Delete ||
96
 
                                   key == Key.BackSpace) {
97
 
                                OnDeleteKeyPressEvent (evnt);
98
 
-                       } else if (Services.Keybinder.Bindings.Any (k => k.KeyString == Services.Keybinder.KeyEventToString (evnt))) {
99
 
+                       } else if (Services.Keybinder.Bindings.Any (k => k.KeyString == Services.Keybinder.KeyEventToString (evnt.KeyValue, (uint)evnt.State))) {
100
 
                                // User set keybindings
101
 
-                               Services.Keybinder.Bindings.First (k => k.KeyString == Services.Keybinder.KeyEventToString (evnt)).Callback (evnt);
102
 
+                               Services.Keybinder.Bindings.First (k => k.KeyString == Services.Keybinder.KeyEventToString (evnt.KeyValue, (uint)evnt.State)).Callback (evnt);
103
 
                        } else {
104
 
                                OnInputKeyPressEvent (evnt);
105
 
                        }
106
 
Index: Do/src/Do.UI/KeybindingTreeView.cs
107
 
===================================================================
108
 
--- Do/src/Do.UI/KeybindingTreeView.cs.orig     2011-03-19 21:03:28.000000000 +1100
109
 
+++ Do/src/Do.UI/KeybindingTreeView.cs  2012-03-18 21:02:51.200703571 +1100
110
 
@@ -110,8 +110,8 @@
111
 
                        
112
 
                        store = Model as ListStore;
113
 
                        store.GetIter (out iter, new TreePath (args.PathString));
114
 
-                       
115
 
-                       string realKey = Gtk.Accelerator.Name (args.AccelKey, args.AccelMods);
116
 
+                                               
117
 
+                       string realKey = Services.Keybinder.KeyEventToString (args.AccelKey, (uint)args.AccelMods);
118
 
                        
119
 
                        if (args.AccelKey == (uint) Gdk.Key.Super_L || args.AccelKey == (uint) Gdk.Key.Super_R) {
120
 
                                //setting CellRenderAccelMode to "Other" ignores the Super key as a modifier