summaryrefslogtreecommitdiffstats
path: root/screenshot-forkbomb.patch
diff options
context:
space:
mode:
Diffstat (limited to 'screenshot-forkbomb.patch')
-rw-r--r--screenshot-forkbomb.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/screenshot-forkbomb.patch b/screenshot-forkbomb.patch
new file mode 100644
index 0000000..3df4b5b
--- /dev/null
+++ b/screenshot-forkbomb.patch
@@ -0,0 +1,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)