[PATCH RFC] XQuartz: Constrain the pointer to the updated display bounds on display reconfigure.

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Mar 19 17:31:18 PDT 2010

Currently on 1.7 and 1.8, when OSX's display configuration changes, the server is left in a state where input pointer events get clipped to the old display region.  This can be worked around by running 'xinput test pointer' after the reconfig.

I'm trying to figure out how to best solve this problem.  There are two places where this clipping is occuring.  First is based on the VCP's miPointer's limits.  The second is based on the VCP's sprite limits.

The following patch "fixes" the problem, but I'm sure there is a better way to handle this.  Please comment.



Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
 hw/xquartz/quartz.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 3c04205..b29e60f 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -277,8 +277,16 @@ void QuartzUpdateScreens(void) {
     //pScreen->PaintWindowBackground (pRoot, &pRoot->borderClip,  PW_BACKGROUND);
     miPaintWindow(pRoot, &pRoot->borderClip,  PW_BACKGROUND);
-//  TODO: This is a noop in 1.6 and nuked in master... we may need to do something else now to handle it
-//    DefineInitialRootWindow(pRoot);
+    /* <rdar://problem/7770779> pointer events are clipped to old display region after display reconfiguration
+     * http://xquartz.macosforge.org/trac/ticket/346
+     */
+    bounds.x1 = 0;
+    bounds.x2 = width;
+    bounds.y1 = 0;
+    bounds.y2 = height;
+    pScreen->ConstrainCursor(inputInfo.pointer, pScreen, &bounds);
+    inputInfo.pointer->spriteInfo->sprite->physLimits = bounds;
+    inputInfo.pointer->spriteInfo->sprite->hotLimits = bounds;
     DEBUG_LOG("Root Window: %dx%d @ (%d, %d) darwinMainScreen (%d, %d) xy (%d, %d) dixScreenOrigins (%d, %d)\n", width, height, x - sx, y - sy, darwinMainScreenX, darwinMainScreenY, x, y, dixScreenOrigins[pScreen->myNum].x, dixScreenOrigins[pScreen->myNum].y);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3333 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100319/f5e64d2b/attachment-0001.bin>

More information about the xorg-devel mailing list