mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Hide mouse cursor after delay in DolphinWX
This commit is contained in:
@ -448,6 +448,10 @@ CFrame::CFrame(wxFrame* parent, wxWindowID id, const wxString& title, wxRect geo
|
|||||||
Bind(wxEVT_TIMER, &CFrame::PollHotkeys, this, m_poll_hotkey_timer.GetId());
|
Bind(wxEVT_TIMER, &CFrame::PollHotkeys, this, m_poll_hotkey_timer.GetId());
|
||||||
m_poll_hotkey_timer.Start(1000 / 60, wxTIMER_CONTINUOUS);
|
m_poll_hotkey_timer.Start(1000 / 60, wxTIMER_CONTINUOUS);
|
||||||
|
|
||||||
|
m_cursor_timer.SetOwner(this);
|
||||||
|
Bind(wxEVT_TIMER, &CFrame::HandleCursorTimer, this, m_cursor_timer.GetId());
|
||||||
|
m_cursor_timer.StartOnce(MOUSE_HIDE_DELAY);
|
||||||
|
|
||||||
// Shut down cleanly on SIGINT, SIGTERM (Unix) and on various signals on Windows
|
// Shut down cleanly on SIGINT, SIGTERM (Unix) and on various signals on Windows
|
||||||
m_handle_signal_timer.SetOwner(this);
|
m_handle_signal_timer.SetOwner(this);
|
||||||
Bind(wxEVT_TIMER, &CFrame::HandleSignal, this, m_handle_signal_timer.GetId());
|
Bind(wxEVT_TIMER, &CFrame::HandleSignal, this, m_handle_signal_timer.GetId());
|
||||||
@ -1122,6 +1126,13 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
|||||||
|
|
||||||
void CFrame::OnMouse(wxMouseEvent& event)
|
void CFrame::OnMouse(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
|
if (!SConfig::GetInstance().bHideCursor && main_frame->RendererHasFocus() &&
|
||||||
|
Core::GetState() == Core::State::Running)
|
||||||
|
{
|
||||||
|
m_render_parent->SetCursor(wxNullCursor);
|
||||||
|
m_cursor_timer.StartOnce(MOUSE_HIDE_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
// next handlers are all for FreeLook, so we don't need to check them if disabled
|
// next handlers are all for FreeLook, so we don't need to check them if disabled
|
||||||
if (!g_Config.bFreeLook)
|
if (!g_Config.bFreeLook)
|
||||||
{
|
{
|
||||||
@ -1699,6 +1710,13 @@ void CFrame::HandleFrameSkipHotkeys()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFrame::HandleCursorTimer(wxTimerEvent& event)
|
||||||
|
{
|
||||||
|
if (!SConfig::GetInstance().bHideCursor && main_frame->RendererHasFocus() &&
|
||||||
|
Core::GetState() == Core::State::Running)
|
||||||
|
m_render_parent->SetCursor(wxCURSOR_BLANK);
|
||||||
|
}
|
||||||
|
|
||||||
void CFrame::HandleSignal(wxTimerEvent& event)
|
void CFrame::HandleSignal(wxTimerEvent& event)
|
||||||
{
|
{
|
||||||
if (!s_shutdown_signal_received.TestAndClear())
|
if (!s_shutdown_signal_received.TestAndClear())
|
||||||
|
@ -144,6 +144,7 @@ private:
|
|||||||
ADD_PANE_CENTER
|
ADD_PANE_CENTER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static constexpr int MOUSE_HIDE_DELAY = 3000;
|
||||||
GameListCtrl* m_game_list_ctrl = nullptr;
|
GameListCtrl* m_game_list_ctrl = nullptr;
|
||||||
CConfigMain* m_main_config_dialog = nullptr;
|
CConfigMain* m_main_config_dialog = nullptr;
|
||||||
wxPanel* m_panel = nullptr;
|
wxPanel* m_panel = nullptr;
|
||||||
@ -167,6 +168,7 @@ private:
|
|||||||
int m_save_slot = 1;
|
int m_save_slot = 1;
|
||||||
|
|
||||||
wxTimer m_poll_hotkey_timer;
|
wxTimer m_poll_hotkey_timer;
|
||||||
|
wxTimer m_cursor_timer;
|
||||||
wxTimer m_handle_signal_timer;
|
wxTimer m_handle_signal_timer;
|
||||||
|
|
||||||
wxMenuBar* m_menubar_shadow = nullptr;
|
wxMenuBar* m_menubar_shadow = nullptr;
|
||||||
@ -360,6 +362,7 @@ private:
|
|||||||
|
|
||||||
void PollHotkeys(wxTimerEvent&);
|
void PollHotkeys(wxTimerEvent&);
|
||||||
void ParseHotkeys();
|
void ParseHotkeys();
|
||||||
|
void HandleCursorTimer(wxTimerEvent&);
|
||||||
void HandleSignal(wxTimerEvent&);
|
void HandleSignal(wxTimerEvent&);
|
||||||
|
|
||||||
bool InitControllers();
|
bool InitControllers();
|
||||||
|
@ -502,7 +502,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
|
|||||||
szr_other->Add(CreateCheckBoxRefBool(page_general, _("Keep Window on Top"),
|
szr_other->Add(CreateCheckBoxRefBool(page_general, _("Keep Window on Top"),
|
||||||
wxGetTranslation(keep_window_on_top_desc),
|
wxGetTranslation(keep_window_on_top_desc),
|
||||||
SConfig::GetInstance().bKeepWindowOnTop));
|
SConfig::GetInstance().bKeepWindowOnTop));
|
||||||
szr_other->Add(CreateCheckBoxRefBool(page_general, _("Hide Mouse Cursor"),
|
szr_other->Add(CreateCheckBoxRefBool(page_general, _("Always Hide Mouse Cursor"),
|
||||||
wxGetTranslation(hide_mouse_cursor_desc),
|
wxGetTranslation(hide_mouse_cursor_desc),
|
||||||
SConfig::GetInstance().bHideCursor));
|
SConfig::GetInstance().bHideCursor));
|
||||||
szr_other->Add(render_to_main_checkbox =
|
szr_other->Add(render_to_main_checkbox =
|
||||||
|
Reference in New Issue
Block a user