summaryrefslogtreecommitdiff
path: root/put.c
diff options
context:
space:
mode:
authorRoland Baer <roland@Vista.(none)>2007-08-16 16:25:04 +0300
committerDennis Kasprzyk <onestone@opencompositing.org>2007-08-16 16:09:51 +0200
commitc0c99902e71485e9e0c3e2169c15d31ed4683113 (patch)
tree34f0cbfbb2e8fd667aab4555e9ca82cdc8769605 /put.c
parent838aa89ea844588a2ef6794193ae76b2cf7d6ad9 (diff)
downloadput-c0c99902e71485e9e0c3e2169c15d31ed4683113.tar.gz
put-c0c99902e71485e9e0c3e2169c15d31ed4683113.tar.bz2
[PATCH] Sanity check on return value of XQueryPointer()
Diffstat (limited to 'put.c')
-rw-r--r--put.c72
1 files changed, 38 insertions, 34 deletions
diff --git a/put.c b/put.c
index 23d8ca9..a1f922a 100644
--- a/put.c
+++ b/put.c
@@ -521,41 +521,45 @@ putInitiate (CompDisplay *d,
unsigned int pMask;
/* get the pointers position from the X server */
- XQueryPointer (d->display, w->id, &root, &child,
- &rx, &ry, &winX, &winY, &pMask);
-
- if (putGetWindowCenter (s))
+ if (XQueryPointer (d->display, w->id, &root, &child,
+ &rx, &ry, &winX, &winY, &pMask))
{
- /* window center */
- dx = rx - (w->width / 2) - x;
- dy = ry - (w->height / 2) - y;
- }
- else if (rx < s->workArea.width / 2 &&
- ry < s->workArea.height / 2)
- {
- /* top left quad */
- dx = rx - x + w->input.left;
- dy = ry - y + w->input.top;
- }
- else if (rx < s->workArea.width / 2 &&
- ry >= s->workArea.height / 2)
- {
- /* bottom left quad */
- dx = rx - x + w->input.left;
- dy = ry - w->height - y - w->input.bottom;
- }
- else if (rx >= s->workArea.width / 2 &&
- ry < s->workArea.height / 2)
- {
- /* top right quad */
- dx = rx - w->width - x - w->input.right;
- dy = ry - y + w->input.top;
- }
- else
- {
- /* bottom right quad */
- dx = rx - w->width - x - w->input.right;
- dy = ry - w->height - y - w->input.bottom;
+
+ if (putGetWindowCenter (s))
+ {
+ /* window center */
+ dx = rx - (w->width / 2) - x;
+ dy = ry - (w->height / 2) - y;
+ }
+ else if (rx < s->workArea.width / 2 &&
+ ry < s->workArea.height / 2)
+ {
+ /* top left quad */
+ dx = rx - x + w->input.left;
+ dy = ry - y + w->input.top;
+ }
+ else if (rx < s->workArea.width / 2 &&
+ ry >= s->workArea.height / 2)
+ {
+ /* bottom left quad */
+ dx = rx - x + w->input.left;
+ dy = ry - w->height - y - w->input.bottom;
+ }
+ else if (rx >= s->workArea.width / 2 &&
+ ry < s->workArea.height / 2)
+ {
+ /* top right quad */
+ dx = rx - w->width - x - w->input.right;
+ dy = ry - y + w->input.top;
+ }
+ else
+ {
+ /* bottom right quad */
+ dx = rx - w->width - x - w->input.right;
+ dy = ry - w->height - y - w->input.bottom;
+ }
+ } else {
+ dx = dy = 0;
}
}
break;