Merge pull request #93976 from Hilderin/fix-caret-disappear-from-script-editor

Fix caret can disappear from script editor
This commit is contained in:
Rémi Verschelde 2024-07-08 19:13:31 +02:00
commit 3220b6fb11
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 9 additions and 4 deletions

View File

@ -3808,9 +3808,9 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_ACTIVATE: { case WM_ACTIVATE: {
// Activation can happen just after the window has been created, even before the callbacks are set. // Activation can happen just after the window has been created, even before the callbacks are set.
// Therefore, it's safer to defer the delivery of the event. // Therefore, it's safer to defer the delivery of the event.
if (!windows[window_id].activate_timer_id) { // It's important to set an nIDEvent different from the SetTimer for move_timer_id because
windows[window_id].activate_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC) nullptr); // if the same nIDEvent is passed, the timer is replaced and the same timer_id is returned.
} windows[window_id].activate_timer_id = SetTimer(windows[window_id].hWnd, DisplayServerWindows::TIMER_ID_WINDOW_ACTIVATION, USER_TIMER_MINIMUM, (TIMERPROC) nullptr);
windows[window_id].activate_state = GET_WM_ACTIVATE_STATE(wParam, lParam); windows[window_id].activate_state = GET_WM_ACTIVATE_STATE(wParam, lParam);
return 0; return 0;
} break; } break;
@ -4728,7 +4728,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_ENTERSIZEMOVE: { case WM_ENTERSIZEMOVE: {
Input::get_singleton()->release_pressed_events(); Input::get_singleton()->release_pressed_events();
windows[window_id].move_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC) nullptr); windows[window_id].move_timer_id = SetTimer(windows[window_id].hWnd, DisplayServerWindows::TIMER_ID_MOVE_REDRAW, USER_TIMER_MINIMUM, (TIMERPROC) nullptr);
} break; } break;
case WM_EXITSIZEMOVE: { case WM_EXITSIZEMOVE: {
KillTimer(windows[window_id].hWnd, windows[window_id].move_timer_id); KillTimer(windows[window_id].hWnd, windows[window_id].move_timer_id);

View File

@ -332,6 +332,11 @@ class DisplayServerWindows : public DisplayServer {
String tablet_driver; String tablet_driver;
Vector<String> tablet_drivers; Vector<String> tablet_drivers;
enum TimerID {
TIMER_ID_MOVE_REDRAW = 1,
TIMER_ID_WINDOW_ACTIVATION = 2,
};
enum { enum {
KEY_EVENT_BUFFER_SIZE = 512 KEY_EVENT_BUFFER_SIZE = 512
}; };