Fix T45771: Walk mode fails on OSX
This commit is contained in:
@@ -62,6 +62,9 @@
|
||||
|
||||
#define USE_TABLET_SUPPORT
|
||||
|
||||
/* ensure the target position is one we can reach, see: T45771 */
|
||||
#define USE_PIXELSIZE_NATIVE_SUPPORT
|
||||
|
||||
/* prototypes */
|
||||
static float getVelocityZeroTime(const float gravity, const float velocity);
|
||||
|
||||
@@ -578,6 +581,16 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
|
||||
walk->center_mval[0] = walk->ar->winx * 0.5f;
|
||||
walk->center_mval[1] = walk->ar->winy * 0.5f;
|
||||
|
||||
#ifdef USE_PIXELSIZE_NATIVE_SUPPORT
|
||||
walk->center_mval[0] += walk->ar->winrct.xmin;
|
||||
walk->center_mval[1] += walk->ar->winrct.ymin;
|
||||
|
||||
WM_cursor_comaptible_xy(win, &walk->center_mval[0], &walk->center_mval[1]);
|
||||
|
||||
walk->center_mval[0] -= walk->ar->winrct.xmin;
|
||||
walk->center_mval[1] -= walk->ar->winrct.ymin;
|
||||
#endif
|
||||
|
||||
copy_v2_v2_int(walk->prev_mval, walk->center_mval);
|
||||
|
||||
WM_cursor_warp(win,
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -1556,6 +1556,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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user