Added support for xwayland keyboard grab

(cherry picked from commit 896b7bc711)
This commit is contained in:
akallabeth 2020-10-27 14:17:37 +01:00
parent f00d7aa644
commit aca1866fc9
3 changed files with 14 additions and 2 deletions

View File

@ -940,6 +940,7 @@ static int _xf_error_handler(Display* d, XErrorEvent* ev)
* another window. This make xf_error_handler() a potential
* debugger breakpoint.
*/
XUngrabKeyboard(d, CurrentTime);
return xf_error_handler(d, ev);
}
@ -1905,6 +1906,8 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
XFree(data);
}
xfc->_XWAYLAND_MAY_GRAB_KEYBOARD =
XInternAtom(xfc->display, "_XWAYLAND_MAY_GRAB_KEYBOARD", False);
xfc->_NET_WM_ICON = XInternAtom(xfc->display, "_NET_WM_ICON", False);
xfc->_MOTIF_WM_HINTS = XInternAtom(xfc->display, "_MOTIF_WM_HINTS", False);
xfc->_NET_CURRENT_DESKTOP = XInternAtom(xfc->display, "_NET_CURRENT_DESKTOP", False);

View File

@ -123,11 +123,11 @@ static void xf_SetWindowTitleText(xfContext* xfc, Window window, const char* nam
*/
void xf_SendClientEvent(xfContext* xfc, Window window, Atom atom, unsigned int numArgs, ...)
{
XEvent xevent;
XEvent xevent = { 0 };
unsigned int i;
va_list argp;
va_start(argp, numArgs);
ZeroMemory(&xevent, sizeof(XEvent));
xevent.xclient.type = ClientMessage;
xevent.xclient.serial = 0;
xevent.xclient.send_event = False;
@ -574,6 +574,10 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig
}
window->floatbar = xf_floatbar_new(xfc, window->handle, name, settings->Floatbar);
if (xfc->_XWAYLAND_MAY_GRAB_KEYBOARD)
xf_SendClientEvent(xfc, window->handle, xfc->_XWAYLAND_MAY_GRAB_KEYBOARD, 1, 1);
return window;
}
@ -819,6 +823,9 @@ int xf_AppWindowCreate(xfContext* xfc, xfAppWindow* appWindow)
FocusChangeMask | PropertyChangeMask | ColormapChangeMask | OwnerGrabButtonMask;
XSelectInput(xfc->display, appWindow->handle, input_mask);
if (xfc->_XWAYLAND_MAY_GRAB_KEYBOARD)
xf_SendClientEvent(xfc, appWindow->handle, xfc->_XWAYLAND_MAY_GRAB_KEYBOARD, 1, 1);
return 1;
}

View File

@ -190,6 +190,8 @@ struct xf_context
Atom UTF8_STRING;
Atom _XWAYLAND_MAY_GRAB_KEYBOARD;
Atom _NET_WM_ICON;
Atom _MOTIF_WM_HINTS;
Atom _NET_CURRENT_DESKTOP;