1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
--- metacity-2.28.0/src/include/all-keybindings.h 2009-09-08 16:55:35.000000000 -0400
+++ hacked/src/include/all-keybindings.h 2009-11-24 21:32:04.351687546 -0500
@@ -76,6 +76,7 @@
#define BINDING_PER_WINDOW 0x01
#define BINDING_REVERSES 0x02
#define BINDING_IS_REVERSED 0x04
+#define BINDING_NO_REPEAT 0x08
#endif /* _BINDINGS_DEFINED_CONSTANTS */
@@ -234,9 +235,9 @@
keybind (run_command_31, handle_run_command, 30, 0, NULL, NULL)
keybind (run_command_32, handle_run_command, 31, 0, NULL, NULL)
-keybind (run_command_screenshot, handle_run_command, 32, 0, "Print",
+keybind (run_command_screenshot, handle_run_command, 32, BINDING_NO_REPEAT, "Print",
_("Take a screenshot"))
-keybind (run_command_window_screenshot, handle_run_command, 33, 0,"<Alt>Print",
+keybind (run_command_window_screenshot, handle_run_command, 33, BINDING_NO_REPEAT, "<Alt>Print",
_("Take a screenshot of a window"))
keybind (run_command_terminal, handle_run_terminal, 0, 0, NULL, _("Run a terminal"))
--- metacity-2.28.0/src/core/keybindings.c 2009-09-08 16:55:35.000000000 -0400
+++ hacked/src/core/keybindings.c 2009-11-24 21:37:02.614687728 -0500
@@ -122,6 +122,7 @@
unsigned int mask;
MetaVirtualModifier modifiers;
const MetaKeyHandler *handler;
+ gboolean repeating;
};
#define keybind(name, handler, param, flags, stroke, description) \
@@ -1172,10 +1173,6 @@
{
int i;
- /* we used to have release-based bindings but no longer. */
- if (event->type == KeyRelease)
- return FALSE;
-
/*
* TODO: This would be better done with a hash table;
* it doesn't suit to use O(n) for such a common operation.
@@ -1185,12 +1182,12 @@
const MetaKeyHandler *handler = bindings[i].handler;
if ((!on_window && handler->flags & BINDING_PER_WINDOW) ||
- event->type != KeyPress ||
+ (event->type == KeyRelease && !(handler->flags & BINDING_NO_REPEAT)) ||
bindings[i].keycode != event->xkey.keycode ||
((event->xkey.state & 0xff & ~(display->ignored_modifier_mask)) !=
bindings[i].mask))
continue;
-
+
/*
* window must be non-NULL for on_window to be true,
* and so also window must be non-NULL if we get here and
@@ -2370,6 +2367,25 @@
const char *command;
GError *err;
+ if (event->type == KeyRelease)
+ {
+ meta_topic (META_DEBUG_KEYBINDINGS,
+ "Key release, binding %s\n",
+ binding->name);
+ binding->repeating = FALSE;
+ return;
+ }
+
+ if (binding->repeating)
+ {
+ meta_topic (META_DEBUG_KEYBINDINGS,
+ "Key repeat ignored, binding %s\n",
+ binding->name);
+ return;
+ }
+
+ binding->repeating = TRUE;
+
command = meta_prefs_get_command (which);
if (command == NULL)
|