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.
|
* 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/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -740,6 +740,9 @@ doit:
|
|||||||
/* Release video and make it redraw the screen. */
|
/* Release video and make it redraw the screen. */
|
||||||
endblit();
|
endblit();
|
||||||
device_force_redraw();
|
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.
|
* 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/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -78,6 +78,7 @@ extern void do_stop(void);
|
|||||||
/* Internal platform support functions. */
|
/* Internal platform support functions. */
|
||||||
extern void set_language(int id);
|
extern void set_language(int id);
|
||||||
extern int get_vidpause(void);
|
extern int get_vidpause(void);
|
||||||
|
extern void show_cursor(int);
|
||||||
|
|
||||||
extern void keyboard_getkeymap(void);
|
extern void keyboard_getkeymap(void);
|
||||||
extern void keyboard_handle(LPARAM lParam, int infocus);
|
extern void keyboard_handle(LPARAM lParam, int infocus);
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* user Interface module for WinAPI on Windows.
|
* 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/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -64,6 +64,25 @@ static int hook_enabled = 0;
|
|||||||
static int save_window_pos = 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
|
HICON
|
||||||
LoadIconEx(PCTSTR pszIconName)
|
LoadIconEx(PCTSTR pszIconName)
|
||||||
{
|
{
|
||||||
@@ -938,15 +957,12 @@ plat_mouse_capture(int on)
|
|||||||
GetClipCursor(&oldclip);
|
GetClipCursor(&oldclip);
|
||||||
GetWindowRect(hwndRender, &rect);
|
GetWindowRect(hwndRender, &rect);
|
||||||
ClipCursor(&rect);
|
ClipCursor(&rect);
|
||||||
while (1) {
|
show_cursor(0);
|
||||||
if (ShowCursor(FALSE) < 0) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
mouse_capture = 1;
|
mouse_capture = 1;
|
||||||
} else if (!on && mouse_capture) {
|
} else if (!on && mouse_capture) {
|
||||||
/* Disable the in-app mouse. */
|
/* Disable the in-app mouse. */
|
||||||
ClipCursor(&oldclip);
|
ClipCursor(&oldclip);
|
||||||
ShowCursor(TRUE);
|
show_cursor(1);
|
||||||
|
|
||||||
mouse_capture = 0;
|
mouse_capture = 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user