mirror of
https://github.com/godotengine/godot
synced 2024-09-15 21:39:58 +00:00
Merge pull request #57248 from bruvzg/win_confined
This commit is contained in:
commit
bb1f55c387
|
@ -706,6 +706,15 @@ void DisplayServerWindows::window_set_current_screen(int p_screen, WindowID p_wi
|
||||||
Vector2 ofs = window_get_position(p_window) - screen_get_position(window_get_current_screen(p_window));
|
Vector2 ofs = window_get_position(p_window) - screen_get_position(window_get_current_screen(p_window));
|
||||||
window_set_position(ofs + screen_get_position(p_screen), p_window);
|
window_set_position(ofs + screen_get_position(p_screen), p_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't let the mouse leave the window when resizing to a smaller resolution.
|
||||||
|
if (mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) {
|
||||||
|
RECT crect;
|
||||||
|
GetClientRect(wd.hWnd, &crect);
|
||||||
|
ClientToScreen(wd.hWnd, (POINT *)&crect.left);
|
||||||
|
ClientToScreen(wd.hWnd, (POINT *)&crect.right);
|
||||||
|
ClipCursor(&crect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Point2i DisplayServerWindows::window_get_position(WindowID p_window) const {
|
Point2i DisplayServerWindows::window_get_position(WindowID p_window) const {
|
||||||
|
@ -1068,6 +1077,15 @@ void DisplayServerWindows::window_set_mode(WindowMode p_mode, WindowID p_window)
|
||||||
SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, 0, 0);
|
SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't let the mouse leave the window when resizing to a smaller resolution.
|
||||||
|
if (mouse_mode == MOUSE_MODE_CONFINED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN) {
|
||||||
|
RECT crect;
|
||||||
|
GetClientRect(wd.hWnd, &crect);
|
||||||
|
ClientToScreen(wd.hWnd, (POINT *)&crect.left);
|
||||||
|
ClientToScreen(wd.hWnd, (POINT *)&crect.right);
|
||||||
|
ClipCursor(&crect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayServer::WindowMode DisplayServerWindows::window_get_mode(WindowID p_window) const {
|
DisplayServer::WindowMode DisplayServerWindows::window_get_mode(WindowID p_window) const {
|
||||||
|
@ -2897,6 +2915,9 @@ void DisplayServerWindows::_process_activate_event(WindowID p_window_id, WPARAM
|
||||||
alt_mem = false;
|
alt_mem = false;
|
||||||
control_mem = false;
|
control_mem = false;
|
||||||
shift_mem = false;
|
shift_mem = false;
|
||||||
|
|
||||||
|
// Restore mouse mode.
|
||||||
|
_set_mouse_mode_impl(mouse_mode);
|
||||||
} else { // WM_INACTIVE.
|
} else { // WM_INACTIVE.
|
||||||
Input::get_singleton()->release_pressed_events();
|
Input::get_singleton()->release_pressed_events();
|
||||||
_send_window_event(windows[p_window_id], WINDOW_EVENT_FOCUS_OUT);
|
_send_window_event(windows[p_window_id], WINDOW_EVENT_FOCUS_OUT);
|
||||||
|
|
Loading…
Reference in a new issue