Switch to xcb for sync extension

Since XCB 1.10 the sync extension is working properly. At the time of
the 5.3 release 1.10 will have been out for ~15 months, enough time
for distros to catch up and should allow us to use it.

As our CI system only supports 1.9 at the moment we cannot hard depend
on the version, instead we use feature info. As soon as our CI system
supports it, we should update the required min version and kick out the
ifdef.

REVIEW: 122377
This commit is contained in:
Martin Gräßlin 2015-02-02 10:07:10 +01:00
parent 0faf2fbcf8
commit 551b3a4c48
3 changed files with 16 additions and 6 deletions

View file

@ -184,6 +184,12 @@ endif()
add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applications for KWin") add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applications for KWin")
add_feature_info("XCB-CURSOR" XCB_CURSOR_FOUND "Required for XCursor support") add_feature_info("XCB-CURSOR" XCB_CURSOR_FOUND "Required for XCursor support")
set(HAVE_XCB_SYNC TRUE)
if (XCB_VERSION VERSION_LESS "1.10")
set(HAVE_XCB_SYNC FALSE)
endif()
add_feature_info("XCB-SYNC" HAVE_XCB_SYNC "XCB Sync version >= 1.10 required for synced window resizing")
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
########### configure tests ############### ########### configure tests ###############
@ -471,7 +477,6 @@ set(kwin_KDE_LIBS
set(kwin_XLIB_LIBS set(kwin_XLIB_LIBS
${X11_X11_LIB} ${X11_X11_LIB}
${X11_Xext_LIB}
${X11_ICE_LIB} ${X11_ICE_LIB}
${X11_SM_LIB} ${X11_SM_LIB}
) )

View file

@ -57,7 +57,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QScriptProgram> #include <QScriptProgram>
#include <QWhatsThis> #include <QWhatsThis>
// XLib // XLib
#include <X11/extensions/sync.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <fixx11h.h> #include <fixx11h.h>
#include <xcb/xtest.h> #include <xcb/xtest.h>
@ -1989,6 +1988,7 @@ void Client::getIcons()
void Client::getSyncCounter() void Client::getSyncCounter()
{ {
#if HAVE_XCB_SYNC
if (!Xcb::Extensions::self()->isSyncAvailable()) if (!Xcb::Extensions::self()->isSyncAvailable())
return; return;
@ -2014,13 +2014,17 @@ void Client::getSyncCounter()
if (!error.isNull()) { if (!error.isNull()) {
syncRequest.alarm = XCB_NONE; syncRequest.alarm = XCB_NONE;
} else { } else {
XSyncAlarmAttributes attrs; xcb_sync_change_alarm_value_list_t value;
XSyncIntToValue(&attrs.trigger.wait_value, 1); memset(&value, 0, sizeof(value));
XSyncIntToValue(&attrs.delta, 1); value.value.hi = 0;
XSyncChangeAlarm(display(), syncRequest.alarm, XSyncCADelta | XSyncCAValue, &attrs); value.value.lo = 1;
value.delta.hi = 0;
value.delta.lo = 1;
xcb_sync_change_alarm_aux(c, syncRequest.alarm, XCB_SYNC_CA_DELTA | XCB_SYNC_CA_VALUE, &value);
} }
} }
} }
#endif
} }
/** /**

View file

@ -14,6 +14,7 @@
#cmakedefine01 HAVE_XKB #cmakedefine01 HAVE_XKB
#cmakedefine01 HAVE_INPUT #cmakedefine01 HAVE_INPUT
#cmakedefine01 HAVE_XCB_CURSOR #cmakedefine01 HAVE_XCB_CURSOR
#cmakedefine01 HAVE_XCB_SYNC
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1 #cmakedefine HAVE_UNISTD_H 1