summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-12-18 23:05:43 -0500
committerKristian Høgsberg <krh@redhat.com>2008-12-18 23:06:26 -0500
commit90e701df0898538ca06ad4327697a4e55644b4d4 (patch)
tree94b8c7180648b86718f46f4da60895903cea7317
parent2d4219e54222f7bd5fd2b89f03ba5a0701b9f3e6 (diff)
downloadwayland-90e701df0898538ca06ad4327697a4e55644b4d4.tar.gz
wayland-90e701df0898538ca06ad4327697a4e55644b4d4.tar.xz
wayland-90e701df0898538ca06ad4327697a4e55644b4d4.zip
Force pointer to stay on screen.
Without this change it's really easy to accidentally send the pointer flying and not be able to get it back.
-rw-r--r--egl-compositor.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/egl-compositor.c b/egl-compositor.c
index b0e5552..a019454 100644
--- a/egl-compositor.c
+++ b/egl-compositor.c
@@ -724,9 +724,19 @@ void
notify_motion(struct egl_input_device *device, int x, int y)
{
struct egl_surface *es;
+ struct egl_compositor *ec = device->ec;
const int hotspot_x = 16, hotspot_y = 16;
int32_t sx, sy;
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+ if (x >= ec->width)
+ x = ec->width - 1;
+ if (y >= ec->height)
+ y = ec->height - 1;
+
es = pick_surface(device);
if (es) {