From 551b3a4c48eeceef562a9e9db7c558b906480aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 2 Feb 2015 10:07:10 +0100 Subject: [PATCH] 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 --- CMakeLists.txt | 7 ++++++- client.cpp | 14 +++++++++----- config-kwin.h.cmake | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 732a7b68e8..6dbfcc961f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,12 @@ endif() 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") +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) ########### configure tests ############### @@ -471,7 +477,6 @@ set(kwin_KDE_LIBS set(kwin_XLIB_LIBS ${X11_X11_LIB} - ${X11_Xext_LIB} ${X11_ICE_LIB} ${X11_SM_LIB} ) diff --git a/client.cpp b/client.cpp index 167bbdd707..74649a3fb3 100644 --- a/client.cpp +++ b/client.cpp @@ -57,7 +57,6 @@ along with this program. If not, see . #include #include // XLib -#include #include #include #include @@ -1989,6 +1988,7 @@ void Client::getIcons() void Client::getSyncCounter() { +#if HAVE_XCB_SYNC if (!Xcb::Extensions::self()->isSyncAvailable()) return; @@ -2014,13 +2014,17 @@ void Client::getSyncCounter() if (!error.isNull()) { syncRequest.alarm = XCB_NONE; } else { - XSyncAlarmAttributes attrs; - XSyncIntToValue(&attrs.trigger.wait_value, 1); - XSyncIntToValue(&attrs.delta, 1); - XSyncChangeAlarm(display(), syncRequest.alarm, XSyncCADelta | XSyncCAValue, &attrs); + xcb_sync_change_alarm_value_list_t value; + memset(&value, 0, sizeof(value)); + value.value.hi = 0; + 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 } /** diff --git a/config-kwin.h.cmake b/config-kwin.h.cmake index cf6cac2aea..8e8a805891 100644 --- a/config-kwin.h.cmake +++ b/config-kwin.h.cmake @@ -14,6 +14,7 @@ #cmakedefine01 HAVE_XKB #cmakedefine01 HAVE_INPUT #cmakedefine01 HAVE_XCB_CURSOR +#cmakedefine01 HAVE_XCB_SYNC /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H 1