xcb: move XSync extensions initialization to QXcbConnection
... where we do initialization of all other extensions. Having this code in QXcbVirtualDesktop does not make sense. Change-Id: I3bf3034b4a24e06aa5792e7d49133f46c5728b07 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
ee8c052395
commit
3d17542cde
@ -590,6 +590,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
|
|||||||
|
|
||||||
initializeAllAtoms();
|
initializeAllAtoms();
|
||||||
|
|
||||||
|
initializeXSync();
|
||||||
initializeShm();
|
initializeShm();
|
||||||
if (!qEnvironmentVariableIsSet("QT_XCB_NO_XRANDR"))
|
if (!qEnvironmentVariableIsSet("QT_XCB_NO_XRANDR"))
|
||||||
initializeXRandr();
|
initializeXRandr();
|
||||||
@ -2248,6 +2249,15 @@ void QXcbConnection::initializeXKB()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QXcbConnection::initializeXSync()
|
||||||
|
{
|
||||||
|
const xcb_query_extension_reply_t *reply = xcb_get_extension_data(xcb_connection(), &xcb_sync_id);
|
||||||
|
if (!reply || !reply->present)
|
||||||
|
return;
|
||||||
|
|
||||||
|
has_sync_extension = true;
|
||||||
|
}
|
||||||
|
|
||||||
QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const
|
QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const
|
||||||
{
|
{
|
||||||
if (!m_systemTrayTracker) {
|
if (!m_systemTrayTracker) {
|
||||||
|
@ -475,6 +475,7 @@ public:
|
|||||||
bool hasXInput2() const { return m_xi2Enabled; }
|
bool hasXInput2() const { return m_xi2Enabled; }
|
||||||
bool hasShm() const { return has_shm; }
|
bool hasShm() const { return has_shm; }
|
||||||
bool hasShmFd() const { return has_shm_fd; }
|
bool hasShmFd() const { return has_shm_fd; }
|
||||||
|
bool hasXSync() const { return has_sync_extension; }
|
||||||
|
|
||||||
bool threadedEventHandling() const { return m_reader->isRunning(); }
|
bool threadedEventHandling() const { return m_reader->isRunning(); }
|
||||||
|
|
||||||
@ -548,6 +549,7 @@ private:
|
|||||||
void initializeXinerama();
|
void initializeXinerama();
|
||||||
void initializeXShape();
|
void initializeXShape();
|
||||||
void initializeXKB();
|
void initializeXKB();
|
||||||
|
void initializeXSync();
|
||||||
void handleClientMessageEvent(const xcb_client_message_event_t *event);
|
void handleClientMessageEvent(const xcb_client_message_event_t *event);
|
||||||
QXcbScreen* findScreenForCrtc(xcb_window_t rootWindow, xcb_randr_crtc_t crtc) const;
|
QXcbScreen* findScreenForCrtc(xcb_window_t rootWindow, xcb_randr_crtc_t crtc) const;
|
||||||
QXcbScreen* findScreenForOutput(xcb_window_t rootWindow, xcb_randr_output_t output) const;
|
QXcbScreen* findScreenForOutput(xcb_window_t rootWindow, xcb_randr_output_t output) const;
|
||||||
@ -694,6 +696,7 @@ private:
|
|||||||
bool has_render_extension = false;
|
bool has_render_extension = false;
|
||||||
bool has_shm = false;
|
bool has_shm = false;
|
||||||
bool has_shm_fd = false;
|
bool has_shm_fd = false;
|
||||||
|
bool has_sync_extension = false;
|
||||||
|
|
||||||
QPair<int, int> m_xrenderVersion;
|
QPair<int, int> m_xrenderVersion;
|
||||||
|
|
||||||
|
@ -95,12 +95,6 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t
|
|||||||
m_windowManagerName = QXcbWindow::windowTitle(connection, windowManager);
|
m_windowManagerName = QXcbWindow::windowTitle(connection, windowManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
const xcb_query_extension_reply_t *sync_reply = xcb_get_extension_data(xcb_connection(), &xcb_sync_id);
|
|
||||||
if (!sync_reply || !sync_reply->present)
|
|
||||||
m_syncRequestSupported = false;
|
|
||||||
else
|
|
||||||
m_syncRequestSupported = true;
|
|
||||||
|
|
||||||
xcb_depth_iterator_t depth_iterator =
|
xcb_depth_iterator_t depth_iterator =
|
||||||
xcb_screen_allowed_depths_iterator(screen);
|
xcb_screen_allowed_depths_iterator(screen);
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ public:
|
|||||||
int antialiasingEnabled() const { return m_antialiasingEnabled; }
|
int antialiasingEnabled() const { return m_antialiasingEnabled; }
|
||||||
|
|
||||||
QString windowManagerName() const { return m_windowManagerName; }
|
QString windowManagerName() const { return m_windowManagerName; }
|
||||||
bool syncRequestSupported() const { return m_syncRequestSupported; }
|
|
||||||
|
|
||||||
QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &format) const;
|
QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &format) const;
|
||||||
|
|
||||||
@ -130,7 +129,6 @@ private:
|
|||||||
QFontEngine::SubpixelAntialiasingType m_subpixelType = QFontEngine::SubpixelAntialiasingType(-1);
|
QFontEngine::SubpixelAntialiasingType m_subpixelType = QFontEngine::SubpixelAntialiasingType(-1);
|
||||||
int m_antialiasingEnabled = -1;
|
int m_antialiasingEnabled = -1;
|
||||||
QString m_windowManagerName;
|
QString m_windowManagerName;
|
||||||
bool m_syncRequestSupported = false;
|
|
||||||
QMap<xcb_visualid_t, xcb_visualtype_t> m_visuals;
|
QMap<xcb_visualid_t, xcb_visualtype_t> m_visuals;
|
||||||
QMap<xcb_visualid_t, quint8> m_visualDepths;
|
QMap<xcb_visualid_t, quint8> m_visualDepths;
|
||||||
};
|
};
|
||||||
@ -187,7 +185,6 @@ public:
|
|||||||
|
|
||||||
void windowShown(QXcbWindow *window);
|
void windowShown(QXcbWindow *window);
|
||||||
QString windowManagerName() const { return m_virtualDesktop->windowManagerName(); }
|
QString windowManagerName() const { return m_virtualDesktop->windowManagerName(); }
|
||||||
bool syncRequestSupported() const { return m_virtualDesktop->syncRequestSupported(); }
|
|
||||||
|
|
||||||
QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &format) const;
|
QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &format) const;
|
||||||
|
|
||||||
|
@ -446,9 +446,7 @@ void QXcbWindow::create()
|
|||||||
properties[propertyCount++] = atom(QXcbAtom::WM_TAKE_FOCUS);
|
properties[propertyCount++] = atom(QXcbAtom::WM_TAKE_FOCUS);
|
||||||
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_PING);
|
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_PING);
|
||||||
|
|
||||||
m_usingSyncProtocol = platformScreen->syncRequestSupported();
|
if (connection()->hasXSync())
|
||||||
|
|
||||||
if (m_usingSyncProtocol)
|
|
||||||
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
|
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
|
||||||
|
|
||||||
if (window()->flags() & Qt::WindowContextHelpButtonHint)
|
if (window()->flags() & Qt::WindowContextHelpButtonHint)
|
||||||
@ -472,7 +470,7 @@ void QXcbWindow::create()
|
|||||||
XCB_ATOM_STRING, 8, wmClass.size(), wmClass.constData());
|
XCB_ATOM_STRING, 8, wmClass.size(), wmClass.constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_usingSyncProtocol) {
|
if (connection()->hasXSync()) {
|
||||||
m_syncCounter = xcb_generate_id(xcb_connection());
|
m_syncCounter = xcb_generate_id(xcb_connection());
|
||||||
xcb_sync_create_counter(xcb_connection(), m_syncCounter, m_syncValue);
|
xcb_sync_create_counter(xcb_connection(), m_syncCounter, m_syncValue);
|
||||||
|
|
||||||
@ -575,7 +573,7 @@ void QXcbWindow::destroy()
|
|||||||
if (connection()->mouseGrabber() == this)
|
if (connection()->mouseGrabber() == this)
|
||||||
connection()->setMouseGrabber(nullptr);
|
connection()->setMouseGrabber(nullptr);
|
||||||
|
|
||||||
if (m_syncCounter && m_usingSyncProtocol)
|
if (m_syncCounter && connection()->hasXSync())
|
||||||
xcb_sync_destroy_counter(xcb_connection(), m_syncCounter);
|
xcb_sync_destroy_counter(xcb_connection(), m_syncCounter);
|
||||||
if (m_window) {
|
if (m_window) {
|
||||||
if (m_netWmUserTimeWindow) {
|
if (m_netWmUserTimeWindow) {
|
||||||
@ -1926,7 +1924,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
|
|||||||
connection()->setTime(event->data.data32[1]);
|
connection()->setTime(event->data.data32[1]);
|
||||||
m_syncValue.lo = event->data.data32[2];
|
m_syncValue.lo = event->data.data32[2];
|
||||||
m_syncValue.hi = event->data.data32[3];
|
m_syncValue.hi = event->data.data32[3];
|
||||||
if (m_usingSyncProtocol)
|
if (connection()->hasXSync())
|
||||||
m_syncState = SyncReceived;
|
m_syncState = SyncReceived;
|
||||||
#ifndef QT_NO_WHATSTHIS
|
#ifndef QT_NO_WHATSTHIS
|
||||||
} else if (protocolAtom == atom(QXcbAtom::_NET_WM_CONTEXT_HELP)) {
|
} else if (protocolAtom == atom(QXcbAtom::_NET_WM_CONTEXT_HELP)) {
|
||||||
@ -2001,7 +1999,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *
|
|||||||
}
|
}
|
||||||
m_oldWindowSize = actualGeometry.size();
|
m_oldWindowSize = actualGeometry.size();
|
||||||
|
|
||||||
if (m_usingSyncProtocol && m_syncState == SyncReceived)
|
if (connection()->hasXSync() && m_syncState == SyncReceived)
|
||||||
m_syncState = SyncAndConfigureReceived;
|
m_syncState = SyncAndConfigureReceived;
|
||||||
|
|
||||||
m_dirtyFrameMargins = true;
|
m_dirtyFrameMargins = true;
|
||||||
@ -2474,7 +2472,7 @@ void QXcbWindow::updateSyncRequestCounter()
|
|||||||
// window manager does not expect a sync event yet.
|
// window manager does not expect a sync event yet.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_usingSyncProtocol && (m_syncValue.lo != 0 || m_syncValue.hi != 0)) {
|
if (connection()->hasXSync() && (m_syncValue.lo != 0 || m_syncValue.hi != 0)) {
|
||||||
xcb_sync_set_counter(xcb_connection(), m_syncCounter, m_syncValue);
|
xcb_sync_set_counter(xcb_connection(), m_syncCounter, m_syncValue);
|
||||||
xcb_flush(xcb_connection());
|
xcb_flush(xcb_connection());
|
||||||
|
|
||||||
|
@ -255,7 +255,6 @@ protected:
|
|||||||
|
|
||||||
bool m_mapped = false;
|
bool m_mapped = false;
|
||||||
bool m_transparent = false;
|
bool m_transparent = false;
|
||||||
bool m_usingSyncProtocol = false;
|
|
||||||
bool m_deferredActivation = false;
|
bool m_deferredActivation = false;
|
||||||
bool m_embedded = false;
|
bool m_embedded = false;
|
||||||
bool m_alertState = false;
|
bool m_alertState = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user