From 0ac4e4e419949a08f5f7744b1bb98b023da4fe93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 25 Apr 2014 12:25:12 +0200 Subject: [PATCH] Port reading net_wm_sync_request_counter to XCB Using the new Xcb::Property wrapper. --- client.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/client.cpp b/client.cpp index 3b80ae3f6c..ea1322302b 100644 --- a/client.cpp +++ b/client.cpp @@ -2158,16 +2158,10 @@ void Client::getSyncCounter() if (!Xcb::Extensions::self()->isSyncAvailable()) return; - Atom retType; - unsigned long nItemRet; - unsigned long byteRet; - int formatRet; - unsigned char* propRet; - int ret = XGetWindowProperty(display(), window(), atoms->net_wm_sync_request_counter, - 0, 1, false, XCB_ATOM_CARDINAL, &retType, &formatRet, &nItemRet, &byteRet, &propRet); - - if (ret == Success && formatRet == 32) { - syncRequest.counter = *(xcb_sync_counter_t*)(propRet); + Xcb::Property syncProp(false, window(), atoms->net_wm_sync_request_counter, XCB_ATOM_CARDINAL, 0, 1); + const xcb_sync_counter_t counter = syncProp.value(XCB_NONE); + if (counter != XCB_NONE) { + syncRequest.counter = counter; syncRequest.value.hi = 0; syncRequest.value.lo = 0; auto *c = connection(); @@ -2193,9 +2187,6 @@ void Client::getSyncCounter() } } } - - if (ret == Success) - XFree(propRet); } /**