diff options
Diffstat (limited to 'platform/x11/os_x11.cpp')
-rw-r--r-- | platform/x11/os_x11.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 49a2f14bef..b59fab7088 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -195,14 +195,13 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au XIDeviceInfo *dev = &info[i]; if (!dev->enabled) continue; - /*if (dev->use != XIMasterPointer) - continue;*/ + if (!(dev->use == XIMasterPointer || dev->use == XIFloatingSlave)) + continue; bool direct_touch = false; for (int j = 0; j < dev->num_classes; j++) { if (dev->classes[j]->type == XITouchClass && ((XITouchClassInfo *)dev->classes[j])->mode == XIDirectTouch) { direct_touch = true; - printf("%d) %d %s\n", i, dev->attachment, dev->name); break; } } @@ -215,7 +214,7 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au XIFreeDeviceInfo(info); if (!touch.devices.size()) { - fprintf(stderr, "No suitable touch device found\n"); + fprintf(stderr, "No touch devices found\n"); } } } @@ -359,7 +358,7 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au // Must be alive after this block static unsigned char mask_data[XIMaskLen(XI_LASTEVENT)] = {}; - touch.event_mask.deviceid = XIAllMasterDevices; + touch.event_mask.deviceid = XIAllDevices; touch.event_mask.mask_len = sizeof(mask_data); touch.event_mask.mask = mask_data; @@ -370,12 +369,14 @@ void OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_au XISelectEvents(x11_display, x11_window, &touch.event_mask, 1); - XIClearMask(touch.event_mask.mask, XI_TouchOwnership); + // Disabled by now since grabbing also blocks mouse events + // (they are received as extended events instead of standard events) + /*XIClearMask(touch.event_mask.mask, XI_TouchOwnership); // Grab touch devices to avoid OS gesture interference for (int i = 0; i < touch.devices.size(); ++i) { XIGrabDevice(x11_display, touch.devices[i], x11_window, CurrentTime, None, XIGrabModeAsync, XIGrabModeAsync, False, &touch.event_mask); - } + }*/ } #endif @@ -1512,7 +1513,7 @@ void OS_X11::process_xevents() { #ifdef TOUCH_ENABLED if (XGetEventData(x11_display, &event.xcookie)) { - if (event.xcookie.extension == touch.opcode) { + if (event.xcookie.type == GenericEvent && event.xcookie.extension == touch.opcode) { XIDeviceEvent *event_data = (XIDeviceEvent *)event.xcookie.data; int index = event_data->detail; @@ -1521,7 +1522,8 @@ void OS_X11::process_xevents() { switch (event_data->evtype) { case XI_TouchBegin: // Fall-through - XIAllowTouchEvents(x11_display, event_data->deviceid, event_data->detail, x11_window, XIAcceptTouch); + // Disabled hand-in-hand with the grabbing + //XIAllowTouchEvents(x11_display, event_data->deviceid, event_data->detail, x11_window, XIAcceptTouch); case XI_TouchEnd: { @@ -1567,9 +1569,8 @@ void OS_X11::process_xevents() { } break; } } - - XFreeEventData(x11_display, &event.xcookie); } + XFreeEventData(x11_display, &event.xcookie); #endif switch (event.type) { @@ -1615,10 +1616,10 @@ void OS_X11::process_xevents() { GrabModeAsync, GrabModeAsync, x11_window, None, CurrentTime); } #ifdef TOUCH_ENABLED - // Grab touch devices to avoid OS gesture interference - for (int i = 0; i < touch.devices.size(); ++i) { + // Grab touch devices to avoid OS gesture interference + /*for (int i = 0; i < touch.devices.size(); ++i) { XIGrabDevice(x11_display, touch.devices[i], x11_window, CurrentTime, None, XIGrabModeAsync, XIGrabModeAsync, False, &touch.event_mask); - } + }*/ #endif if (xic) { XSetICFocus(xic); @@ -1638,9 +1639,9 @@ void OS_X11::process_xevents() { } #ifdef TOUCH_ENABLED // Ungrab touch devices so input works as usual while we are unfocused - for (int i = 0; i < touch.devices.size(); ++i) { + /*for (int i = 0; i < touch.devices.size(); ++i) { XIUngrabDevice(x11_display, touch.devices[i], CurrentTime); - } + }*/ // Release every pointer to avoid sticky points for (Map<int, Vector2>::Element *E = touch.state.front(); E; E = E->next()) { |