summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2025-08-29 12:18:09 -0400
committerLuke from DC <[email protected]>2025-11-01 19:22:36 +0000
commit7e100f3ed4f1279c67d596654b665e3f347ca455 (patch)
tree5749a0bd2c809f5af5347dd918edeee198307f1d
parent17c0b318817c96013d6967daf4e2d79539d23627 (diff)
downloadmarco-7e100f3ed4f1279c67d596654b665e3f347ca455.tar.bz2
marco-7e100f3ed4f1279c67d596654b665e3f347ca455.tar.xz
keybindings: Release keyboard grab on screenshot commands
This prevents race conditions with applications like mate-screenshot that need to grab input (e.g. for area selection). Fixes mate-desktop/mate-utils#37
-rw-r--r--src/core/keybindings.c9
-rw-r--r--src/core/prefs.c4
-rw-r--r--src/include/prefs.h5
3 files changed, 14 insertions, 4 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index c74577f9..b1b1780a 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2510,6 +2510,15 @@ handle_run_command (MetaDisplay *display,
return;
}
+ /* Release keyboard grabs immediately for screenshot commands that may need
+ * input grabbing. This prevents race conditions with applications like
+ * mate-screenshot that need to grab input for area selection.
+ */
+ if (which >= SCREENSHOT_COMMAND_IDX && which <= WIN_SCREENSHOT_COMMAND_IDX)
+ {
+ ungrab_keyboard (display, event->xkey.time);
+ }
+
err = NULL;
if (!meta_spawn_command_line_async_on_screen (command, screen, &err))
{
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 23ed5d45..5299cf81 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -36,10 +36,6 @@
#define MAX_REASONABLE_WORKSPACES 36
-#define MAX_COMMANDS (32 + NUM_EXTRA_COMMANDS)
-#define NUM_EXTRA_COMMANDS 2
-#define SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 2)
-#define WIN_SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 1)
/* If you add a key, it needs updating in init() and in the GSettings
* notify listener and of course in the .gschema file.
diff --git a/src/include/prefs.h b/src/include/prefs.h
index 1bd7e258..ebfd2c55 100644
--- a/src/include/prefs.h
+++ b/src/include/prefs.h
@@ -29,6 +29,11 @@
#include "common.h"
#include <pango/pango-font.h>
+#define MAX_COMMANDS (32 + NUM_EXTRA_COMMANDS)
+#define NUM_EXTRA_COMMANDS 2
+#define SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 2)
+#define WIN_SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 1)
+
typedef enum
{
META_PREF_MOUSE_BUTTON_MODS,