summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-01-03 14:29:41 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-01-03 14:30:21 +0100
commitb5ab7ee0d78a30863e3d11bd2ba10ba5f4854bf5 (patch)
treed4ab3471f9f92e153fe320e0435a5740c794746b /src/plugins/platforms/xcb/qxcbconnection.cpp
parentad9554a7f2d4b8a2af3efabc7bc69b9a0ae3751d (diff)
parentaff3e3c4a20aae52fdafaede8dfcbde2bc990104 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 6fd2241f71..5e632bff7f 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -262,12 +262,19 @@ 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)
{
+#ifdef XCB_USE_EGL
+ EGLNativeDisplayType dpy = EGL_DEFAULT_DISPLAY;
+#elif defined(XCB_USE_XLIB)
+ Display *dpy;
+#endif
#ifdef XCB_USE_XLIB
- Display *dpy = XOpenDisplay(m_displayName.constData());
+ dpy = XOpenDisplay(m_displayName.constData());
if (dpy) {
m_primaryScreen = DefaultScreen(dpy);
m_connection = XGetXCBConnection(dpy);
@@ -276,7 +283,6 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
m_xlib_display = dpy;
}
#else
- EGLNativeDisplayType dpy = EGL_DEFAULT_DISPLAY;
m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreen);
#endif //XCB_USE_XLIB
@@ -733,6 +739,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)
@@ -743,6 +751,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
@@ -798,6 +808,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