From 7af0fff9d8830bc0add90632d6b9ab4d2d9661c3 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 17 Jan 2013 10:16:40 +0000 Subject: Bug fix #33892 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 | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index ebde6407a48..180b6b9c742 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -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); -- cgit v1.2.3