summaryrefslogtreecommitdiff
path: root/dix/inpututils.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-09-07 14:04:10 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-10-13 11:26:09 +1000
commit8bebb4b4896d8b6ba3309b5b28fce883bb9f8a96 (patch)
treecb2419bbda70f25479db2e1e58f65779a602270c /dix/inpututils.c
parent9cbfa4739a51e4cc6b8094833928bf8678f63876 (diff)
Store desktop dimensions in screenInfo.
For Zaphod mode screen crossing handling we need to know the size of all screens together (i.e. the whole desktop size). Store that in the screenInfo to have it readily available in events. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/inpututils.c')
-rw-r--r--dix/inpututils.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/dix/inpututils.c b/dix/inpututils.c
index eeae2a74f..8a834442c 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -628,6 +628,30 @@ point_on_screen(ScreenPtr pScreen, int x, int y)
}
/**
+ * Update desktop dimensions on the screenInfo struct.
+ */
+void
+update_desktop_dimensions(void)
+{
+ int i;
+ int x1 = INT_MAX, y1 = INT_MAX; /* top-left */
+ int x2 = INT_MIN, y2 = INT_MIN; /* bottom-right */
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr screen = screenInfo.screens[i];
+ x1 = min(x1, screen->x);
+ y1 = min(y1, screen->y);
+ x2 = max(x2, screen->x + screen->width);
+ y2 = max(y2, screen->y + screen->height);
+ }
+
+ screenInfo.x = x1;
+ screenInfo.y = y1;
+ screenInfo.width = x2 - x1;
+ screenInfo.height = y2 - y1;
+}
+
+/*
* Delete the element with the key from the list, freeing all memory
* associated with the element..
*/