now deleting property when so requested even if read failed.
This commit is contained in:
parent
4bf6cf2adf
commit
3f046bb48a
|
@ -21,6 +21,7 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window,
|
||||||
CXWindowsUtil::CErrorLock lock(display);
|
CXWindowsUtil::CErrorLock lock(display);
|
||||||
|
|
||||||
// read the property
|
// read the property
|
||||||
|
int result = Success;
|
||||||
const long length = XMaxRequestSize(display);
|
const long length = XMaxRequestSize(display);
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
unsigned long bytesLeft = 1;
|
unsigned long bytesLeft = 1;
|
||||||
|
@ -28,13 +29,13 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window,
|
||||||
// get more data
|
// get more data
|
||||||
unsigned long numItems;
|
unsigned long numItems;
|
||||||
unsigned char* rawData;
|
unsigned char* rawData;
|
||||||
const int result = XGetWindowProperty(display, window, property,
|
result = XGetWindowProperty(display, window, property,
|
||||||
offset, length, False, AnyPropertyType,
|
offset, length, False, AnyPropertyType,
|
||||||
&actualType, &actualDatumSize,
|
&actualType, &actualDatumSize,
|
||||||
&numItems, &bytesLeft, &rawData);
|
&numItems, &bytesLeft, &rawData);
|
||||||
if (result != Success || actualType == None || actualDatumSize == 0) {
|
if (result != Success || actualType == None || actualDatumSize == 0) {
|
||||||
// failed
|
// failed
|
||||||
return false;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// compute bytes read and advance offset
|
// compute bytes read and advance offset
|
||||||
|
@ -83,8 +84,14 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window,
|
||||||
*format = static_cast<SInt32>(actualDatumSize);
|
*format = static_cast<SInt32>(actualDatumSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
log((CLOG_DEBUG1 "read property %d on window 0x%08x: bytes=%d", property, window, (data == NULL) ? 0 : data->size()));
|
if (result == Success) {
|
||||||
return true;
|
log((CLOG_DEBUG1 "read property %d on window 0x%08x: bytes=%d", property, window, (data == NULL) ? 0 : data->size()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log((CLOG_DEBUG1 "can't read property %d on window 0x%08x", property, window));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in New Issue