diff options
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.h')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 9a73006cec..de454b5eae 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -35,7 +35,9 @@ #define QXCBCONNECTION_H #include <xcb/xcb.h> +#include <xcb/randr.h> +#include "qxcbexport.h" #include <QHash> #include <QList> #include <QMutex> @@ -76,6 +78,7 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQpaXInput) Q_DECLARE_LOGGING_CATEGORY(lcQpaXInputDevices) +Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen) class QXcbScreen; class QXcbWindow; @@ -85,6 +88,7 @@ class QXcbClipboard; class QXcbWMSupport; class QXcbNativeInterface; class QXcbSystemTrayTracker; +class QXcbGlIntegration; namespace QXcbAtom { enum Atom { @@ -295,7 +299,7 @@ class QXcbEventReader : public QThread public: QXcbEventReader(QXcbConnection *connection); - void run(); + void run() Q_DECL_OVERRIDE; QXcbEventArray *lock(); void unlock(); @@ -360,7 +364,7 @@ private: }; class QAbstractEventDispatcher; -class QXcbConnection : public QObject +class Q_XCB_EXPORT QXcbConnection : public QObject { Q_OBJECT public: @@ -395,24 +399,22 @@ public: QXcbWMSupport *wmSupport() const { return m_wmSupport.data(); } xcb_window_t rootWindow(); #ifdef XCB_USE_XLIB - void *xlib_display() const { return m_xlib_display; } + void *xlib_display() const; #endif -#ifdef XCB_USE_EGL - bool hasEgl() const; -#endif -#if defined(XCB_USE_EGL) - void *egl_display() const { return m_egl_display; } -#endif #if defined(XCB_USE_XINPUT2) void xi2Select(xcb_window_t window); #endif #ifdef XCB_USE_XINPUT21 - bool isUsingXInput21() { return m_xi2Enabled && m_xi2Minor >= 1; } + bool isUsingXInput21() const { return m_xi2Enabled && m_xi2Minor >= 1; } #else - bool isUsingXInput21() { return false; } + bool isUsingXInput21() const { return false; } +#endif +#ifdef XCB_USE_XINPUT22 + bool isUsingXInput22() const { return m_xi2Enabled && m_xi2Minor >= 2; } +#else + bool isUsingXInput22() const { return false; } #endif - void sync(); @@ -437,15 +439,14 @@ public: inline xcb_timestamp_t netWmUserTime() const { return m_netWmUserTime; } inline void setNetWmUserTime(xcb_timestamp_t t) { if (t > m_netWmUserTime) m_netWmUserTime = t; } - bool hasGLX() const { return has_glx_extension; } bool hasXFixes() const { return xfixes_first_event > 0; } bool hasXShape() const { return has_shape_extension; } bool hasXRandr() const { return has_randr_extension; } bool hasInputShape() const { return has_input_shape; } - bool hasTouchWithoutMouseEmulation() const { return has_touch_without_mouse_emulation; } bool hasXKB() const { return has_xkb; } bool supportsThreadedRendering() const { return m_reader->isRunning(); } + bool threadedEventHandling() const { return m_reader->isRunning(); } xcb_timestamp_t getTimestamp(); @@ -472,6 +473,8 @@ public: QXcbEventReader *eventReader() const { return m_reader; } bool canGrab() const { return m_canGrabServer; } + + QXcbGlIntegration *glIntegration() const { return m_glIntegration; } protected: bool event(QEvent *e) Q_DECL_OVERRIDE; @@ -484,16 +487,21 @@ private slots: private: void initializeAllAtoms(); void sendConnectionEvent(QXcbAtom::Atom atom, uint id = 0); - void initializeGLX(); void initializeXFixes(); void initializeXRender(); void initializeXRandr(); void initializeXShape(); void initializeXKB(); void handleClientMessageEvent(const xcb_client_message_event_t *event); - QXcbScreen* findOrCreateScreen(QList<QXcbScreen *>& newScreens, int screenNumber, - xcb_screen_t* xcbScreen, xcb_randr_get_output_info_reply_t *output = NULL); - void updateScreens(); + QXcbScreen* createScreen(int screenNumber, xcb_screen_t* xcbScreen, + xcb_randr_output_t outputId = XCB_NONE, + xcb_randr_get_output_info_reply_t *output = 0); + QXcbScreen* findScreenForCrtc(xcb_window_t rootWindow, xcb_randr_crtc_t crtc); + QXcbScreen* findScreenForOutput(xcb_window_t rootWindow, xcb_randr_output_t output); + xcb_screen_t* xcbScreenForRootWindow(xcb_window_t rootWindow, int *xcbScreenNumber = 0); + bool checkOutputIsPrimary(xcb_window_t rootWindow, xcb_randr_output_t output); + void initializeScreens(); + void updateScreens(const xcb_randr_notify_event_t *event); void handleButtonPress(xcb_generic_event_t *event); void handleButtonRelease(xcb_generic_event_t *event); void handleMotionNotify(xcb_generic_event_t *event); @@ -583,10 +591,6 @@ private: QHash<int, QWindowSystemInterface::TouchPoint> m_touchPoints; QHash<int, XInput2TouchDeviceData*> m_touchDevices; #endif -#if defined(XCB_USE_EGL) - void *m_egl_display; - bool m_has_egl; -#endif #ifdef Q_XCB_DEBUG struct CallInfo { int sequence; @@ -607,13 +611,10 @@ private: uint32_t xfixes_first_event; uint32_t xrandr_first_event; uint32_t xkb_first_event; - uint32_t glx_first_event; - bool has_glx_extension; bool has_shape_extension; bool has_randr_extension; bool has_input_shape; - bool has_touch_without_mouse_emulation; bool has_xkb; Qt::MouseButtons m_buttons; @@ -622,6 +623,7 @@ private: QByteArray m_startupId; QXcbSystemTrayTracker *m_systemTrayTracker; + QXcbGlIntegration *m_glIntegration; friend class QXcbEventReader; }; @@ -668,12 +670,7 @@ cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, #else #define Q_XCB_CALL(x) x #define Q_XCB_CALL2(x, connection) x -#define Q_XCB_NOOP(c) -#endif - - -#if defined(XCB_USE_EGL) -#define EGL_DISPLAY_FROM_XCB(object) ((EGLDisplay)(object->connection()->egl_display())) +#define Q_XCB_NOOP(c) (void)c; #endif QT_END_NAMESPACE |