summaryrefslogtreecommitdiff
path: root/src/XAtom.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-06-27 17:54:32 +0000
committerDana Jansens <danakj@orodu.net>2002-06-27 17:54:32 +0000
commit578a5cc980dd39430fe803a4ca9719075e78e986 (patch)
tree7f6db08ae8dd6cfdc3d9b6b6d6730b03323988d6 /src/XAtom.cc
parentb2e9af88862bc2c084c542fdf5cbfb5049cca1fd (diff)
make fully max'd windows properly snap
Diffstat (limited to 'src/XAtom.cc')
-rw-r--r--src/XAtom.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/XAtom.cc b/src/XAtom.cc
index 545739ab..5945b833 100644
--- a/src/XAtom.cc
+++ b/src/XAtom.cc
@@ -357,12 +357,14 @@ bool XAtom::getValue(Window win, Atom atom, Atom type,
Atom ret_type;
int ret_size;
unsigned long ret_bytes;
+ int result;
const unsigned long maxread = nelements;
// try get the first element
- XGetWindowProperty(_display, win, atom, 0l, 1l, False, AnyPropertyType,
- &ret_type, &ret_size, &nelements, &ret_bytes, &c_val);
- if (ret_type == None || nelements < 1)
- // the property does not exist on the window or is empty
+ result = XGetWindowProperty(_display, win, atom, 0l, 1l, False,
+ AnyPropertyType, &ret_type, &ret_size,
+ &nelements, &ret_bytes, &c_val);
+ if (result != Success || ret_type == None || nelements < 1)
+ // an error occured, the property does not exist on the window, or is empty
return false;
if (ret_type != type || ret_size != size) {
// wrong data in property
@@ -384,8 +386,10 @@ bool XAtom::getValue(Window win, Atom atom, Atom type,
int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1;
if (remain > size/8 * (signed)maxread) // dont get more than the max
remain = size/8 * (signed)maxread;
- XGetWindowProperty(_display, win, atom, 0l, remain, False, type, &ret_type,
- &ret_size, &nelements, &ret_bytes, &c_val);
+ result = XGetWindowProperty(_display, win, atom, 0l, remain, False, type,
+ &ret_type, &ret_size, &nelements, &ret_bytes,
+ &c_val);
+ assert(result == Success);
assert(ret_bytes == 0);
*value = new unsigned char[nelements * size/8 + 1];
memcpy(*value, c_val, nelements * size/8 + 1);