From: Toni Wilen Date: Sat, 2 Mar 2019 19:31:42 +0000 (+0200) Subject: Magic mouse focus/activation fix. X-Git-Tag: 4200~30 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=15ec672da58fcdccd3361b0d059f3bab6076a44c;p=francis%2Fwinuae.git Magic mouse focus/activation fix. --- diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 03daa8ab..2db21761 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -179,6 +179,7 @@ COLORREF g_dwBackgroundColor; int pause_emulation; static int sound_closed; +static int recapture; static int focus; static int mouseinside; int mouseactive; @@ -756,7 +757,7 @@ static void setcursorshape(int monid) void releasecapture(struct AmigaMonitor *mon) { - //write_log(_T("releasecapture %d\n"), showcursor); + //write_log(_T("releasecapture %d\n"), mon_cursorclipped); #if 0 CURSORINFO pci; pci.cbSize = sizeof pci; @@ -967,7 +968,7 @@ static void setmouseactive2(struct AmigaMonitor *mon, int active, bool allowpaus bool isrp = false; #endif - //write_log (_T("setmouseactive %d->%d showcursor=%d focus=%d\n"), mouseactive, active, showcursor, focus); + //write_log (_T("setmouseactive %d->%d cursor=%d focus=%d recap=%d\n"), mouseactive, active, mon_cursorclipped, focus, recapture); if (active == 0) releasecapture (mon); @@ -992,6 +993,7 @@ static void setmouseactive2(struct AmigaMonitor *mon, int active, bool allowpaus mon->mouseposx = mon->mouseposy = 0; //write_log (_T("setmouseactive(%d)\n"), active); releasecapture (mon); + recapture = 0; if (isfullscreen () <= 0 && (currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_tablet > 0) { if (mousehack_alive ()) @@ -1181,6 +1183,7 @@ static void winuae_inactive(struct AmigaMonitor *mon, HWND hWnd, int minimized) UnregisterHotKey (mon->hAmigaWnd, IDHOT_SNAPDESKTOP); #endif focus = 0; + recapture = 0; wait_keyrelease (); setmouseactive(mon->monitor_id, 0); clipboard_active(mon->hAmigaWnd, 0); @@ -1358,6 +1361,9 @@ void setmouseactivexy(int monid, int x, int y, int dir) if (mouseactive) { disablecapture (); SetCursorPos (x, y); + if (dir) { + recapture = 1; + } } } @@ -2207,6 +2213,11 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam, mx -= mon->mouseposx; my -= mon->mouseposy; + if (recapture && isfullscreen() <= 0) { + enablecapture(mon->monitor_id); + return 0; + } + if (wm < 0 && (istablet || currprefs.input_tablet >= TABLET_MOUSEHACK)) { /* absolute */ setmousestate(0, 0, mx, 1);