Fix Windows cursor with trails disappearing in fullscreen
Fixed by turning off mouse trails when going into fullscreen, then restoring trails when exiting fullscreen or game
This commit is contained in:
parent
76a3c72a1d
commit
5a8fe36891
2 changed files with 21 additions and 0 deletions
|
@ -212,6 +212,7 @@ void OS_Windows::initialize_core() {
|
|||
crash_handler.initialize();
|
||||
|
||||
last_button_state = 0;
|
||||
restore_mouse_trails = 0;
|
||||
|
||||
//RedirectIOToConsole();
|
||||
maximized = false;
|
||||
|
@ -1426,6 +1427,13 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
|
|||
video_mode.fullscreen=false;
|
||||
}*/
|
||||
pre_fs_valid = false;
|
||||
|
||||
// If the user has mouse trails enabled in windows, then sometimes the cursor disappears in fullscreen mode.
|
||||
// Save number of trails so we can restore when exiting, then turn off mouse trails
|
||||
SystemParametersInfoA(SPI_GETMOUSETRAILS, 0, &restore_mouse_trails, 0);
|
||||
if (restore_mouse_trails > 1) {
|
||||
SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
DWORD dwExStyle;
|
||||
|
@ -1770,6 +1778,10 @@ void OS_Windows::finalize() {
|
|||
if (user_proc) {
|
||||
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)user_proc);
|
||||
};
|
||||
|
||||
if (restore_mouse_trails > 1) {
|
||||
SystemParametersInfoA(SPI_SETMOUSETRAILS, restore_mouse_trails, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void OS_Windows::finalize_core() {
|
||||
|
@ -2124,6 +2136,10 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) {
|
|||
|
||||
MoveWindow(hWnd, pos.x, pos.y, size.width, size.height, TRUE);
|
||||
|
||||
SystemParametersInfoA(SPI_GETMOUSETRAILS, 0, &restore_mouse_trails, 0);
|
||||
if (restore_mouse_trails > 1) {
|
||||
SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, 0, 0);
|
||||
}
|
||||
} else {
|
||||
RECT rect;
|
||||
|
||||
|
@ -2143,6 +2159,10 @@ void OS_Windows::set_window_fullscreen(bool p_enabled) {
|
|||
MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE);
|
||||
|
||||
pre_fs_valid = true;
|
||||
|
||||
if (restore_mouse_trails > 1) {
|
||||
SystemParametersInfoA(SPI_SETMOUSETRAILS, restore_mouse_trails, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
bool OS_Windows::is_window_fullscreen() const {
|
||||
|
|
|
@ -334,6 +334,7 @@ class OS_Windows : public OS {
|
|||
Vector2 im_position;
|
||||
|
||||
MouseMode mouse_mode;
|
||||
int restore_mouse_trails;
|
||||
bool alt_mem;
|
||||
bool gr_mem;
|
||||
bool shift_mem;
|
||||
|
|
Loading…
Reference in a new issue