Hopefully correct setting of host mouse cursor in window and fullscreen modes.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform main support module for Windows.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.41 2017/12/13
|
||||
* Version: @(#)win.c 1.0.42 2017/12/15
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -740,6 +740,9 @@ doit:
|
||||
/* Release video and make it redraw the screen. */
|
||||
endblit();
|
||||
device_force_redraw();
|
||||
|
||||
/* Finally, handle the host's mouse cursor. */
|
||||
show_cursor(video_fullscreen ? 0 : -1);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform support defintions for Win32.
|
||||
*
|
||||
* Version: @(#)win.h 1.0.12 2017/12/13
|
||||
* Version: @(#)win.h 1.0.13 2017/12/15
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -78,6 +78,7 @@ extern void do_stop(void);
|
||||
/* Internal platform support functions. */
|
||||
extern void set_language(int id);
|
||||
extern int get_vidpause(void);
|
||||
extern void show_cursor(int);
|
||||
|
||||
extern void keyboard_getkeymap(void);
|
||||
extern void keyboard_handle(LPARAM lParam, int infocus);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* user Interface module for WinAPI on Windows.
|
||||
*
|
||||
* Version: @(#)win_ui.c 1.0.8 2017/12/15
|
||||
* Version: @(#)win_ui.c 1.0.9 2017/12/15
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -64,6 +64,25 @@ static int hook_enabled = 0;
|
||||
static int save_window_pos = 0;
|
||||
|
||||
|
||||
/* Set host cursor visible or not. */
|
||||
void
|
||||
show_cursor(int val)
|
||||
{
|
||||
static int old = -1, vis = -1;
|
||||
|
||||
if (vis == val) return;
|
||||
|
||||
if (val < 0)
|
||||
val = old;
|
||||
|
||||
old = vis;
|
||||
while (1) {
|
||||
if (ShowCursor((val == 0) ? FALSE : TRUE) < 0) break;
|
||||
}
|
||||
vis = val;
|
||||
}
|
||||
|
||||
|
||||
HICON
|
||||
LoadIconEx(PCTSTR pszIconName)
|
||||
{
|
||||
@@ -938,15 +957,12 @@ plat_mouse_capture(int on)
|
||||
GetClipCursor(&oldclip);
|
||||
GetWindowRect(hwndRender, &rect);
|
||||
ClipCursor(&rect);
|
||||
while (1) {
|
||||
if (ShowCursor(FALSE) < 0) break;
|
||||
}
|
||||
|
||||
show_cursor(0);
|
||||
mouse_capture = 1;
|
||||
} else if (!on && mouse_capture) {
|
||||
/* Disable the in-app mouse. */
|
||||
ClipCursor(&oldclip);
|
||||
ShowCursor(TRUE);
|
||||
show_cursor(1);
|
||||
|
||||
mouse_capture = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user