From 995c9547cf28d3113bbd9fa66867319b11293615 Mon Sep 17 00:00:00 2001 From: crs Date: Fri, 21 Mar 2003 19:13:15 +0000 Subject: [PATCH] Fixed getWindowProperty(). It wasn't catching all failure cases correctly. --- lib/platform/CXWindowsUtil.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/platform/CXWindowsUtil.cpp b/lib/platform/CXWindowsUtil.cpp index 90d0b0aa..399f2c27 100644 --- a/lib/platform/CXWindowsUtil.cpp +++ b/lib/platform/CXWindowsUtil.cpp @@ -35,7 +35,7 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window, CXWindowsUtil::CErrorLock lock(display); // read the property - int result = Success; + bool okay = true; const long length = XMaxRequestSize(display); long offset = 0; unsigned long bytesLeft = 1; @@ -43,12 +43,13 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window, // get more data unsigned long numItems; unsigned char* rawData; - result = XGetWindowProperty(display, window, property, + if (XGetWindowProperty(display, window, property, offset, length, False, AnyPropertyType, &actualType, &actualDatumSize, - &numItems, &bytesLeft, &rawData); - if (result != Success || actualType == None || actualDatumSize == 0) { + &numItems, &bytesLeft, &rawData) != Success || + actualType == None || actualDatumSize == 0) { // failed + okay = false; break; } @@ -98,12 +99,12 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window, *format = static_cast(actualDatumSize); } - if (result == Success) { + if (okay) { LOG((CLOG_DEBUG2 "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)); + LOG((CLOG_DEBUG2 "can't read property %d on window 0x%08x", property, window)); return false; } }