aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/Overlay.hpp2
-rw-r--r--src/Overlay.cpp15
2 files changed, 14 insertions, 3 deletions
diff --git a/include/Overlay.hpp b/include/Overlay.hpp
index 45776b8..d93edf1 100644
--- a/include/Overlay.hpp
+++ b/include/Overlay.hpp
@@ -67,7 +67,7 @@ namespace gsr {
void process_key_bindings(mgl::Event &event);
void grab_mouse_and_keyboard();
void xi_setup_fake_cursor();
- void xi_grab_all_devices();
+ void xi_grab_all_mouse_devices();
void close_gpu_screen_recorder_output();
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index 0d74637..c38ba36 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -667,7 +667,15 @@ namespace gsr {
XcursorImageDestroy(cursor_image);
}
- void Overlay::xi_grab_all_devices() {
+ static bool device_is_mouse(const XIDeviceInfo *dev) {
+ for(int i = 0; i < dev->num_classes; ++i) {
+ if(dev->classes[i]->type == XIMasterPointer || dev->classes[i]->type == XISlavePointer)
+ return true;
+ }
+ return false;
+ }
+
+ void Overlay::xi_grab_all_mouse_devices() {
if(!xi_display)
return;
@@ -687,6 +695,9 @@ namespace gsr {
for (int i = 0; i < num_devices; ++i) {
const XIDeviceInfo *dev = &info[i];
+ if(!device_is_mouse(dev))
+ continue;
+
XIEventMask xi_masks;
xi_masks.deviceid = dev->deviceid;
xi_masks.mask_len = sizeof(mask);
@@ -989,7 +1000,7 @@ namespace gsr {
// We want to grab all devices to prevent any other application below the UI from receiving events.
// Owlboy seems to use xi events and XGrabPointer doesn't prevent owlboy from receiving events.
- xi_grab_all_devices();
+ xi_grab_all_mouse_devices();
// if(gsr_info.system_info.display_server == DisplayServer::WAYLAND) {
// set_focused_window(display, window->get_system_handle());