Port reading net_wm_sync_request_counter to XCB

Using the new Xcb::Property wrapper.
This commit is contained in:
Martin Gräßlin 2014-04-25 12:25:12 +02:00
parent b36b242f12
commit 0ac4e4e419

View file

@ -2158,16 +2158,10 @@ void Client::getSyncCounter()
if (!Xcb::Extensions::self()->isSyncAvailable()) if (!Xcb::Extensions::self()->isSyncAvailable())
return; return;
Atom retType; Xcb::Property syncProp(false, window(), atoms->net_wm_sync_request_counter, XCB_ATOM_CARDINAL, 0, 1);
unsigned long nItemRet; const xcb_sync_counter_t counter = syncProp.value<xcb_sync_counter_t>(XCB_NONE);
unsigned long byteRet; if (counter != XCB_NONE) {
int formatRet; syncRequest.counter = counter;
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);
syncRequest.value.hi = 0; syncRequest.value.hi = 0;
syncRequest.value.lo = 0; syncRequest.value.lo = 0;
auto *c = connection(); auto *c = connection();
@ -2193,9 +2187,6 @@ void Client::getSyncCounter()
} }
} }
} }
if (ret == Success)
XFree(propRet);
} }
/** /**