[Windows] Hide cursor before moving.
This commit is contained in:
parent
db76de5de8
commit
9a2977fef1
1 changed files with 11 additions and 8 deletions
|
@ -133,9 +133,17 @@ String DisplayServerWindows::get_name() const {
|
|||
}
|
||||
|
||||
void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) {
|
||||
if (p_mode == MOUSE_MODE_HIDDEN || p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_CONFINED_HIDDEN) {
|
||||
// Hide cursor before moving.
|
||||
if (hCursor == nullptr) {
|
||||
hCursor = SetCursor(nullptr);
|
||||
} else {
|
||||
SetCursor(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (windows.has(MAIN_WINDOW_ID) && (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_CONFINED || p_mode == MOUSE_MODE_CONFINED_HIDDEN)) {
|
||||
// Mouse is grabbed (captured or confined).
|
||||
|
||||
WindowID window_id = _get_focused_window_or_popup();
|
||||
if (!windows.has(window_id)) {
|
||||
window_id = MAIN_WINDOW_ID;
|
||||
|
@ -165,13 +173,8 @@ void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) {
|
|||
_register_raw_input_devices(INVALID_WINDOW_ID);
|
||||
}
|
||||
|
||||
if (p_mode == MOUSE_MODE_HIDDEN || p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_CONFINED_HIDDEN) {
|
||||
if (hCursor == nullptr) {
|
||||
hCursor = SetCursor(nullptr);
|
||||
} else {
|
||||
SetCursor(nullptr);
|
||||
}
|
||||
} else {
|
||||
if (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED) {
|
||||
// Show cursor.
|
||||
CursorShape c = cursor_shape;
|
||||
cursor_shape = CURSOR_MAX;
|
||||
cursor_set_shape(c);
|
||||
|
|
Loading…
Reference in a new issue