From 1e6ec53a3029c23606a4d602c4e8170bd0373745 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Fri, 1 May 2020 12:35:43 -0700 Subject: [PATCH] win32 layer mouse capture --- platform_win32/win32_4ed.cpp | 43 ++++++++++++++++++++---------------- ship_files/changes.txt | 3 ++- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index 1a4e8924..f5c8329f 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -1107,25 +1107,25 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case VK_CONTROL:case VK_LCONTROL:case VK_RCONTROL: case VK_MENU:case VK_LMENU:case VK_RMENU: { - switch (vk){ - case VK_CONTROL:case VK_LCONTROL:case VK_RCONTROL: - { - if (is_right){ - controls->r_ctrl = down; - } - else{ - controls->l_ctrl = down; - } - }break; - case VK_MENU:case VK_LMENU:case VK_RMENU: - { - if (is_right){ - controls->r_alt = down; - } - else{ - controls->l_alt = down; - } - }break; + switch (vk){ + case VK_CONTROL:case VK_LCONTROL:case VK_RCONTROL: + { + if (is_right){ + controls->r_ctrl = down; + } + else{ + controls->l_ctrl = down; + } + }break; + case VK_MENU:case VK_LMENU:case VK_RMENU: + { + if (is_right){ + controls->r_alt = down; + } + else{ + controls->l_alt = down; + } + }break; } }break; } @@ -1245,6 +1245,7 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_LBUTTONDOWN: { + SetCapture(hwnd); win32vars.got_useful_event = true; win32vars.input_chunk.trans.mouse_l_press = true; win32vars.input_chunk.pers.mouse_l = true; @@ -1252,6 +1253,7 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_RBUTTONDOWN: { + SetCapture(hwnd); win32vars.got_useful_event = true; win32vars.input_chunk.trans.mouse_r_press = true; win32vars.input_chunk.pers.mouse_r = true; @@ -1259,6 +1261,7 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_LBUTTONUP: { + ReleaseCapture(); win32vars.got_useful_event = true; win32vars.input_chunk.trans.mouse_l_release = true; win32vars.input_chunk.pers.mouse_l = false; @@ -1266,6 +1269,7 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_RBUTTONUP: { + ReleaseCapture(); win32vars.got_useful_event = true; win32vars.input_chunk.trans.mouse_r_release = true; win32vars.input_chunk.pers.mouse_r = false; @@ -1274,6 +1278,7 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_KILLFOCUS: case WM_SETFOCUS: { + ReleaseCapture(); win32vars.got_useful_event = true; win32vars.input_chunk.pers.mouse_l = false; win32vars.input_chunk.pers.mouse_r = false; diff --git a/ship_files/changes.txt b/ship_files/changes.txt index 912bdb54..dfd3da6e 100644 --- a/ship_files/changes.txt +++ b/ship_files/changes.txt @@ -13,7 +13,8 @@ + Fix: windows layer now generates layout independent key stroke events + Fix: notepad like mode scrolling does not snap mark to cursor + Fix: special case colors from the theme override general case colors - + Fix: Paste fade range is updated with buffer edits + + Fix: paste fade range is updated with buffer edits + + Fix: on windows releasing click off window is detected 4.1.4 + MAJOR: The clipboard history is now a fully custom layer implemented system. Users maintaining a customization layer should try to update their call sites to the old clipboard API. #define FCODER_TRANSITION_TO 4001004 to disable the transitional function wrappers when you are ready to make the transition.