diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-09-08 16:35:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-09-08 16:39:37 +0300 |
commit | a93e15aee37cad718fc2a2a53606bc2a35d60802 (patch) | |
tree | d7bee3b383e054ed37e84e2d4ac22cddb524cf8b /source/blender/windowmanager | |
parent | 9d8aaf77ac2e43c29c4f9f8ef633b8b0e78bd1ea (diff) |
Fix T45771: Walk mode fails on OSX
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index a4c4dbfa67f..a21886c1260 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -130,6 +130,7 @@ void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle); void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar); void WM_cursor_warp (struct wmWindow *win, int x, int y); +void WM_cursor_comaptible_xy(wmWindow *win, int *x, int *y); float WM_cursor_pressure (const struct wmWindow *win); /* event map */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index af7e9c8ca33..c2209b2fe7c 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1557,6 +1557,18 @@ void WM_cursor_warp(wmWindow *win, int x, int y) } /** + * Set x, y to values we can actually position the cursor to. + */ +void WM_cursor_comaptible_xy(wmWindow *win, int *x, int *y) +{ + float f = GHOST_GetNativePixelSize(win->ghostwin); + if (f != 1.0f) { + *x = (int)(*x / f) * f; + *y = (int)(*y / f) * f; + } +} + +/** * Get the cursor pressure, in most cases you'll want to use wmTabletData from the event */ float WM_cursor_pressure(const struct wmWindow *win) |