summaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2019-06-18 16:25:51 +0200
committerPierre Ossman <ossman@cendio.se>2019-06-18 16:25:51 +0200
commitda10343f32b9d3f9dcd79254627d010152ecf91e (patch)
treed72915bda85af3121c829462e9c4cb71164467ec /vncviewer
parent3b6dec9fbee4dd18b37e7f7577eaf135b88a0fc6 (diff)
downloadtigervnc-da10343f32b9d3f9dcd79254627d010152ecf91e.tar.gz
tigervnc-da10343f32b9d3f9dcd79254627d010152ecf91e.zip
Request keyboard grab ability under Xwayland
We're usually white listed, but let's be a good citizen and formally request the keyboard grab ability from the compositor.
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/DesktopWindow.cxx22
-rw-r--r--vncviewer/DesktopWindow.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index 150c39bc..c52a9150 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -290,6 +290,28 @@ void DesktopWindow::setCursor(int width, int height,
}
+void DesktopWindow::show()
+{
+ Fl_Window::show();
+
+#if !defined(WIN32) && !defined(__APPLE__)
+ XEvent e;
+
+ // Request ability to grab keyboard under Xwayland
+ e.xany.type = ClientMessage;
+ e.xany.window = fl_xid(this);
+ e.xclient.message_type = XInternAtom (fl_display, "_XWAYLAND_MAY_GRAB_KEYBOARD", 0);
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = 1;
+ e.xclient.data.l[1] = 0;
+ e.xclient.data.l[2] = 0;
+ e.xclient.data.l[3] = 0;
+ e.xclient.data.l[4] = 0;
+ XSendEvent(fl_display, RootWindow(fl_display, fl_screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e);
+#endif
+}
+
+
void DesktopWindow::draw()
{
bool redraw;
diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h
index 6ec8e1bd..c408cb78 100644
--- a/vncviewer/DesktopWindow.h
+++ b/vncviewer/DesktopWindow.h
@@ -73,6 +73,7 @@ public:
void setLEDState(unsigned int state);
// Fl_Window callback methods
+ virtual void show();
void draw();
void resize(int x, int y, int w, int h);