summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-12-23 10:17:06 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-30 10:56:29 +0100
commitecf11d62fc6f57cccf6f3326e768b1c7cabbd0b3 (patch)
treef35d2bdfb6fd273b04db235886551c779557c040 /src/plugins/platforms/xcb/qxcbconnection.cpp
parent5ee3d1e45621da51faaab08cf13d16f22b314309 (diff)
xcb: added env variables to show input devices and events
export QT_XCB_DEBUG_XINPUT_DEVICES=anything to show detected input devices at startup export QT_XCB_DEBUG_XINPUT=anything to log mouse, touch and tablet events Change-Id: Id14844b68ad376740f82a36aab2c59c84d2017ab Task-number: QTBUG-35583 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index c00b4d551b..4f42bb1785 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -262,6 +262,8 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
, has_input_shape(false)
, has_touch_without_mouse_emulation(false)
, has_xkb(false)
+ , debug_xinput_devices(false)
+ , debug_xinput(false)
, m_buttons(0)
, m_focusWindow(0)
, m_systemTrayTracker(0)
@@ -749,6 +751,8 @@ void QXcbConnection::handleButtonPress(xcb_generic_event_t *ev)
// the rest we need to manage ourselves
m_buttons = (m_buttons & ~0x7) | translateMouseButtons(event->state);
m_buttons |= translateMouseButton(event->detail);
+ if (Q_UNLIKELY(debug_xinput))
+ qDebug("xcb: pressed mouse button %d, button state %X", event->detail, static_cast<unsigned int>(m_buttons));
}
void QXcbConnection::handleButtonRelease(xcb_generic_event_t *ev)
@@ -759,6 +763,8 @@ void QXcbConnection::handleButtonRelease(xcb_generic_event_t *ev)
// the rest we need to manage ourselves
m_buttons = (m_buttons & ~0x7) | translateMouseButtons(event->state);
m_buttons &= ~translateMouseButton(event->detail);
+ if (Q_UNLIKELY(debug_xinput))
+ qDebug("xcb: released mouse button %d, button state %X", event->detail, static_cast<unsigned int>(m_buttons));
}
#ifndef QT_NO_XKB
@@ -814,6 +820,10 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
handleButtonRelease(event);
HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent);
case XCB_MOTION_NOTIFY:
+ if (Q_UNLIKELY(debug_xinput)) {
+ xcb_motion_notify_event_t *mev = (xcb_motion_notify_event_t *)event;
+ qDebug("xcb: moved mouse to %4d, %4d; button state %X", mev->event_x, mev->event_y, static_cast<unsigned int>(m_buttons));
+ }
#ifdef QT_NO_XKB
m_keyboard->updateXKBStateFromCore(((xcb_motion_notify_event_t *)event)->state);
#endif