From a20985b83f2e330d94e59c9be4c82261cf5136f4 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 21 Oct 2023 18:34:28 +0300 Subject: [PATCH] GUI pad control mouse mode wraparound --- od-win32/win32gui_extra.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/od-win32/win32gui_extra.cpp b/od-win32/win32gui_extra.cpp index b11447f2..852588cd 100644 --- a/od-win32/win32gui_extra.cpp +++ b/od-win32/win32gui_extra.cpp @@ -2544,7 +2544,7 @@ end: #define MAX_PADS 4 -int gui_control = 1; +int gui_control = 0; void process_gui_control(HWND h, struct newresource *nres) { @@ -2695,16 +2695,32 @@ void process_gui_control(HWND h, struct newresource *nres) GetWindowInfo(h, &wi); r = wi.rcClient; if (pt.x < r.left) { - pt.x = r.left; + if (xdiff < 0) { + pt.x = r.right; + } else { + pt.x = r.left; + } } if (pt.x > r.right) { - pt.x = r.right; + if (xdiff > 0) { + pt.x = r.left; + } else { + pt.x = r.right; + } } if (pt.y < r.top) { - pt.y = r.top; + if (ydiff > 0) { + pt.y = r.bottom; + } else { + pt.y = r.top; + } } if (pt.y > r.bottom) { - pt.y = r.bottom; + if (ydiff < 0) { + pt.y = r.top; + } else { + pt.y = r.bottom; + } } } if (ptx.x != pt.x || ptx.y != pt.y) { -- 2.47.3