Bug fix #33892
authorTon Roosendaal <ton@blender.org>
Thu, 17 Jan 2013 10:16:40 +0000 (10:16 +0000)
committerTon Roosendaal <ton@blender.org>
Thu, 17 Jan 2013 10:16:40 +0000 (10:16 +0000)
HiDPI "retina" mode didn't work for "Continuous Grab" yet.

Note; this mode works by having different coordinate systems
for pixels and window/mouse coords. I really hope future
HiDPI implementations use the same trick.

source/blender/windowmanager/intern/wm_cursors.c

index ebde6407a48c34cefe22abb57aad63d7c07924a5..180b6b9c742b056055a68e83b8434b1eedd48c74 100644 (file)
@@ -188,12 +188,20 @@ void WM_cursor_grab_enable(wmWindow *win, int wrap, int hide, int bounds[4])
         * It helps not to get a stuck WM when hitting a breakpoint  
         * */
        GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
+       float fac = GHOST_GetNativePixelSize(win->ghostwin);
 
+       /* in case pixel coords differ from window/mouse coords */
+       bounds[0] /= fac;
+       bounds[1] /= fac;
+       bounds[2] /= fac;
+       bounds[3] /= fac;
+       
        if (hide) mode = GHOST_kGrabHide;
        else if (wrap) mode = GHOST_kGrabWrap;
        if ((G.debug & G_DEBUG) == 0) {
                if (win && win->ghostwin) {
                        const GHOST_TabletData *tabletdata = GHOST_GetTabletData(win->ghostwin);
+                       
                        /* Note: There is no tabletdata on Windows if no tablet device is connected. */
                        if (!tabletdata)
                                GHOST_SetCursorGrab(win->ghostwin, mode, bounds, NULL);