diff options
author | Nicholas Rishel <rishel.nick@gmail.com> | 2021-06-19 06:38:34 +0300 |
---|---|---|
committer | Nicholas Rishel <rishel.nick@gmail.com> | 2021-06-19 07:03:13 +0300 |
commit | 46221219d880c8148f783788d88b712ec3d19ae0 (patch) | |
tree | a3f0c5b62a259566d8c2931fa1741a96780ada21 | |
parent | 1a484889466650a4d3532437d94b9dfcb6126520 (diff) |
Fix T83930 and Fix T84659: Walk navigation tablet bugs.fix-tablet-walk
Fixes T83930, allowing walk navigation to continue without jumping back
after repositiong pen.
Fixes T84659, allow walk navigation to start (for Windows Ink) from
keyboard shortcut when pen is in use.
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 23 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_walk.c | 11 |
2 files changed, 33 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 09cfa30eca5..32c5dd2b885 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1601,6 +1601,17 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, } else { wt->leaveRange(); + + /* Send mouse event to signal end of tablet tracking to operators. */ + DWORD msgPos = ::GetMessagePos(); + int x = GET_X_LPARAM(msgPos); + int y = GET_Y_LPARAM(msgPos); + event = new GHOST_EventCursor(system->getMilliSeconds(), + GHOST_kEventCursorMove, + window, + x, + y, + GHOST_TABLET_DATA_NONE); } } eventHandled = true; @@ -1640,6 +1651,18 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, /* Reset pointer pen info if pen device has left tracking range. */ if (pointerInfo.pointerType == PT_PEN && !IS_POINTER_INRANGE_WPARAM(wParam)) { window->resetPointerPenInfo(); + + /* Send mouse event to signal end of tablet tracking to operators. */ + DWORD msgPos = ::GetMessagePos(); + int x = GET_X_LPARAM(msgPos); + int y = GET_Y_LPARAM(msgPos); + event = new GHOST_EventCursor(system->getMilliSeconds(), + GHOST_kEventCursorMove, + window, + x, + y, + GHOST_TABLET_DATA_NONE); + eventHandled = true; } break; diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index ab4cf0c2135..d6686696eea 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -693,6 +693,9 @@ static void walkEvent(bContext *C, WalkInfo *walk, const wmEvent *event) if ((walk->center_mval[0] == event->mval[0]) && (walk->center_mval[1] == event->mval[1])) { walk->is_cursor_first = false; } + else if (event->tablet.is_motion_absolute) { + walk->is_cursor_first = false; + } else { /* note, its possible the system isn't giving us the warp event * ideally we shouldn't have to worry about this, see: T45361 */ @@ -704,13 +707,19 @@ static void walkEvent(bContext *C, WalkInfo *walk, const wmEvent *event) return; } - if ((walk->is_cursor_absolute == false) && event->tablet.is_motion_absolute) { + if (!walk->is_cursor_absolute && event->tablet.is_motion_absolute) { walk->is_cursor_absolute = true; copy_v2_v2_int(walk->prev_mval, event->mval); copy_v2_v2_int(walk->center_mval, event->mval); /* Without this we can't turn 180d with the default speed of 1.0. */ walk->mouse_speed *= 4.0f; } + else if (walk->is_cursor_absolute && !event->tablet.is_motion_absolute) { + walk->is_cursor_absolute = false; + walk->is_cursor_first = true; + /* Return walk speed to normal. */ + walk->mouse_speed = U.walk_navigation.mouse_speed; + } #endif /* USE_TABLET_SUPPORT */ walk->moffset[0] += event->mval[0] - walk->prev_mval[0]; |