Skip to content

Commit

Permalink
marshal OnConsoleSetCursorBlinkTime to UI thread (fix mac window size…
Browse files Browse the repository at this point in the history
… and cursor freeze)
  • Loading branch information
elfmz committed Apr 16, 2024
1 parent 0b52136 commit 994bca3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion WinPort/src/Backend/WX/wxMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ wxDEFINE_EVENT(WX_CONSOLE_ADHOC_QEDIT, wxCommandEvent);
wxDEFINE_EVENT(WX_CONSOLE_SET_TWEAKS, wxCommandEvent);
wxDEFINE_EVENT(WX_CONSOLE_CHANGE_FONT, wxCommandEvent);
wxDEFINE_EVENT(WX_CONSOLE_SAVE_WIN_STATE, wxCommandEvent);
wxDEFINE_EVENT(WX_CONSOLE_SET_CURSOR_BLINK_TIME, wxCommandEvent);
wxDEFINE_EVENT(WX_CONSOLE_EXIT, wxCommandEvent);


Expand Down Expand Up @@ -546,6 +547,7 @@ wxBEGIN_EVENT_TABLE(WinPortPanel, wxPanel)
EVT_COMMAND(wxID_ANY, WX_CONSOLE_ADHOC_QEDIT, WinPortPanel::OnConsoleAdhocQuickEditSync)
EVT_COMMAND(wxID_ANY, WX_CONSOLE_SET_TWEAKS, WinPortPanel::OnConsoleSetTweaksSync)
EVT_COMMAND(wxID_ANY, WX_CONSOLE_CHANGE_FONT, WinPortPanel::OnConsoleChangeFontSync)
EVT_COMMAND(wxID_ANY, WX_CONSOLE_SET_CURSOR_BLINK_TIME, WinPortPanel::OnConsoleSetCursorBlinkTimeSync)
EVT_COMMAND(wxID_ANY, WX_CONSOLE_EXIT, WinPortPanel::OnConsoleExitSync)

EVT_IDLE(WinPortPanel::OnIdle)
Expand Down Expand Up @@ -1732,8 +1734,10 @@ void WinPortPanel::OnConsoleExit()
wxQueueEvent(this, event);
}

void WinPortPanel::OnConsoleSetCursorBlinkTime(DWORD interval)
void WinPortPanel::OnConsoleSetCursorBlinkTimeSync( wxCommandEvent& event )
{
EventWithDWORD64 *e = (EventWithDWORD64 *)&event;
DWORD interval = e->cookie;
if (interval < 100 )
g_TIMER_PERIOD = 100;
else if (interval > 500 )
Expand All @@ -1747,6 +1751,13 @@ void WinPortPanel::OnConsoleSetCursorBlinkTime(DWORD interval)
_periodic_timer->Start(g_TIMER_PERIOD);
}

void WinPortPanel::OnConsoleSetCursorBlinkTime(DWORD interval)
{
EventWithDWORD64 *event = new(std::nothrow) EventWithDWORD64(interval, WX_CONSOLE_SET_CURSOR_BLINK_TIME);
if (event)
wxQueueEvent(this, event);
}

void WinPortPanel::CheckPutText2CLip()
{
if (!_text2clip.empty()) {
Expand Down
1 change: 1 addition & 0 deletions WinPort/src/Backend/WX/wxMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class WinPortPanel: public wxPanel, protected IConsoleOutputBackend
void OnConsoleChangeFontSync(wxCommandEvent& event);
void OnConsoleSaveWindowStateSync(wxCommandEvent& event);
void OnConsoleExitSync( wxCommandEvent& event );
void OnConsoleSetCursorBlinkTimeSync(wxCommandEvent& event);
void OnIdle( wxIdleEvent& event );
void OnKeyDown( wxKeyEvent& event );
void OnKeyUp( wxKeyEvent& event );
Expand Down

0 comments on commit 994bca3

Please sign in to comment.