From fcdd222c61da457ed56bc58ef346e896776fe257 Mon Sep 17 00:00:00 2001 From: Gustavo Noronha Silva Date: Thu, 5 Jun 2014 09:42:05 -0300 Subject: [PATCH] device-manager-xi2: use allocation for clamping The coordinates translated by the XI2 device manager were being clamped using the X window size kept by StageX11. However, when the stage is fullscreen, that size is not updated to the screen size, but kept the same in order to allow going back to it when the stage goes out of fullscreen. https://bugzilla.gnome.org/show_bug.cgi?id=731268 --- clutter/x11/clutter-device-manager-xi2.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c index b00cddb90..2c8ced84f 100644 --- a/clutter/x11/clutter-device-manager-xi2.c +++ b/clutter/x11/clutter-device-manager-xi2.c @@ -666,8 +666,15 @@ translate_coords (ClutterStageX11 *stage_x11, gfloat *x_out, gfloat *y_out) { - *x_out = CLAMP (event_x, 0, stage_x11->xwin_width) / stage_x11->scale_factor; - *y_out = CLAMP (event_y, 0, stage_x11->xwin_height) / stage_x11->scale_factor; + ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_x11); + ClutterActor *stage = CLUTTER_ACTOR (stage_cogl->wrapper); + gfloat stage_width; + gfloat stage_height; + + clutter_actor_get_size (stage, &stage_width, &stage_height); + + *x_out = CLAMP (event_x, 0, stage_width) / stage_x11->scale_factor; + *y_out = CLAMP (event_y, 0, stage_height) / stage_x11->scale_factor; } static gdouble