From 63b0bcf5994e456381ac171a99dd39f297578d5b Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sun, 11 Feb 2024 08:23:23 +0100 Subject: KDE+X11 keyboard stops working after menu display (#904) --- src/drivers/X11/Fl_X11_Screen_Driver.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index 7fc7e2b01..76d7801b0 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -428,6 +428,9 @@ extern void fl_fix_focus(); // in Fl.cxx void Fl_X11_Screen_Driver::grab(Fl_Window* win) { + const char *p; + static bool using_kde = + ( p = getenv("XDG_CURRENT_DESKTOP") , (p && (strcmp(p, "KDE") == 0)) ); Fl_Window *fullscreen_win = NULL; for (Fl_Window *W = Fl::first_window(); W; W = Fl::next_window(W)) { if (W->fullscreen_active()) { @@ -448,12 +451,14 @@ void Fl_X11_Screen_Driver::grab(Fl_Window* win) None, 0, fl_event_time); - XGrabKeyboard(fl_display, - xid, - 1, - GrabModeAsync, - GrabModeAsync, - fl_event_time); + if (!using_kde) { // grabbing tends to stick with KDE (#904) + XGrabKeyboard(fl_display, + xid, + 1, + GrabModeAsync, + GrabModeAsync, + fl_event_time); + } } Fl::grab_ = win; // FIXME: Fl::grab_ "should be private", but we need // a way to *set* the variable from the driver! -- cgit v1.2.3