diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index aba165eeba..9ff7a559a0 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -51,8 +51,10 @@ EVT_BUTTON(wxID_CLOSE, CConfigMain::CloseClick) EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::CoreSettingsChanged) +#if wxUSE_TIMER && defined _WIN32 EVT_CHECKBOX(ID_INTERFACE_HIDECURSOR, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_AUTOHIDECURSOR, CConfigMain::CoreSettingsChanged) +#endif EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_LEDS, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_INTERFACE_WIIMOTE_SPEAKERS, CConfigMain::CoreSettingsChanged) @@ -242,12 +244,14 @@ void CConfigMain::CreateGUIControls() UsePanicHandlers = new wxCheckBox(GeneralPage, ID_INTERFACE_USEPANICHANDLERS, wxT("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); UsePanicHandlers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers); +#if wxUSE_TIMER && defined _WIN32 // Hide Cursor wxStaticText *HideCursorText = new wxStaticText(GeneralPage, ID_INTERFACE_HIDECURSOR_TEXT, wxT("Hide Cursor:"), wxDefaultPosition, wxDefaultSize); AutoHideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_AUTOHIDECURSOR, wxT("Auto")); AutoHideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor); HideCursor = new wxCheckBox(GeneralPage, ID_INTERFACE_HIDECURSOR, wxT("Always")); HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor); +#endif // Wiimote status in statusbar wxStaticText *WiimoteStatusText = new wxStaticText(GeneralPage, ID_INTERFACE_WIIMOTE_TEXT, wxT("Show wiimote status:"), wxDefaultPosition, wxDefaultSize); WiimoteStatusLEDs = new wxCheckBox(GeneralPage, ID_INTERFACE_WIIMOTE_LEDS, wxT("LEDs"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); @@ -278,9 +282,11 @@ void CConfigMain::CreateGUIControls() UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured.") wxT(" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin") wxT(" suddenly crashes without any explanation at all.")); +#if wxUSE_TIMER && defined _WIN32 AutoHideCursor->SetToolTip(wxT("This will auto hide the cursor in fullscreen mode.")); HideCursor->SetToolTip(wxT("This will always hide the cursor when it's over the rendering window.") wxT("\nIt can be convenient in a Wii game that already has a cursor.")); +#endif WiimoteStatusLEDs->SetToolTip(wxT("Show which wiimotes are connected in the statusbar.")); WiimoteStatusSpeakers->SetToolTip(wxT("Show wiimote speaker status in the statusbar.")); DSPThread->SetToolTip(wxT("Run DSPLLE on a dedicated thread (not recommended).")); @@ -324,11 +330,13 @@ void CConfigMain::CreateGUIControls() sbInterface = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Interface Settings")); sbInterface->Add(ConfirmStop, 0, wxALL, 5); sbInterface->Add(UsePanicHandlers, 0, wxALL, 5); +#if wxUSE_TIMER && defined _WIN32 wxBoxSizer *sHideCursor = new wxBoxSizer(wxHORIZONTAL); sHideCursor->Add(HideCursorText); sHideCursor->Add(AutoHideCursor, 0, wxLEFT, 5); sHideCursor->Add(HideCursor, 0, wxLEFT, 5); sbInterface->Add(sHideCursor, 0, wxALL, 5); +#endif wxBoxSizer *sWiimoteStatus = new wxBoxSizer(wxHORIZONTAL); sWiimoteStatus->Add(WiimoteStatusText); sWiimoteStatus->Add(WiimoteStatusLEDs, 0, wxLEFT, 5); @@ -661,6 +669,7 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked(); SetEnableAlert(UsePanicHandlers->IsChecked()); break; +#if wxUSE_TIMER && defined _WIN32 case ID_INTERFACE_AUTOHIDECURSOR: if (AutoHideCursor->IsChecked()) HideCursor->SetValue(!AutoHideCursor->IsChecked()); // Update the other one SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor = AutoHideCursor->IsChecked(); @@ -671,6 +680,7 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor = AutoHideCursor->IsChecked(); SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked(); break; +#endif case ID_INTERFACE_THEME: SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection(); main_frame->InitBitmaps(); diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index 36f31456df..632321505f 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -48,8 +48,10 @@ private: DECLARE_EVENT_TABLE(); wxBoxSizer* sGeneralPage; // General Settings - wxCheckBox* ConfirmStop, *AutoHideCursor; - wxCheckBox* HideCursor, *UsePanicHandlers; + wxCheckBox* ConfirmStop, *UsePanicHandlers; +#if wxUSE_TIMER && defined _WIN32 + wxCheckBox* HideCursor, *AutoHideCursor; +#endif wxCheckBox* WiimoteStatusLEDs, * WiimoteStatusSpeakers; wxArrayString arrayStringFor_InterfaceLang; @@ -171,7 +173,9 @@ private: ID_INTERFACE_CONFIRMSTOP, // Interface settings ID_INTERFACE_USEPANICHANDLERS, +#if wxUSE_TIMER && defined _WIN32 ID_INTERFACE_HIDECURSOR_TEXT, ID_INTERFACE_HIDECURSOR, ID_INTERFACE_AUTOHIDECURSOR, +#endif ID_INTERFACE_WIIMOTE_TEXT, ID_INTERFACE_WIIMOTE_LEDS, ID_INTERFACE_WIIMOTE_SPEAKERS, ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG, ID_INTERFACE_THEME, diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index be2499a580..76b2aa1c92 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -285,7 +285,7 @@ EVT_SIZE(CFrame::OnResize) EVT_MOVE(CFrame::OnMove) EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnGameListCtrl_ItemActivated) EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage) -#if wxUSE_TIMER +#if wxUSE_TIMER && defined _WIN32 EVT_TIMER(wxID_ANY, CFrame::OnTimer) #endif @@ -323,9 +323,9 @@ CFrame::CFrame(wxFrame* parent, , UseDebugger(_UseDebugger), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false) , bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false) , HaveLeds(false), HaveSpeakers(false) - , m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0) , m_bControlsCreated(false), bNoWiimoteMsg(false), m_StopDlg(NULL) - #if wxUSE_TIMER + #if wxUSE_TIMER && defined _WIN32 + , m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0) , m_timer(this) #endif @@ -348,7 +348,7 @@ CFrame::CFrame(wxFrame* parent, } // Create timer - #if wxUSE_TIMER + #if wxUSE_TIMER && defined _WIN32 int TimesPerSecond = 10; // We don't need more than this m_timer.Start( floor((double)(1000 / TimesPerSecond)) ); #endif @@ -476,9 +476,11 @@ CFrame::CFrame(wxFrame* parent, wxTheApp->Connect(wxID_ANY, wxEVT_LEFT_DCLICK, wxMouseEventHandler(CFrame::OnDoubleClick), (wxObject*)0, this); +#ifdef _WIN32 && defince _WIN32 wxTheApp->Connect(wxID_ANY, wxEVT_MOTION, wxMouseEventHandler(CFrame::OnMotion), (wxObject*)0, this); +#endif // ---------- // Update controls @@ -504,7 +506,7 @@ CFrame::~CFrame() cdio_free_device_list(drives); /* The statbar sample has this so I add this to, but I guess timer will be deleted after this anyway */ - #if wxUSE_TIMER + #if wxUSE_TIMER && defined _WIN32 if (m_timer.IsRunning()) m_timer.Stop(); #endif @@ -763,6 +765,7 @@ void CFrame::OnDoubleClick(wxMouseEvent& event) // Check for mouse motion. Here we process the bHideCursor setting. +#if wxUSE_TIMER && defined _WIN32 void CFrame::OnMotion(wxMouseEvent& event) { event.Skip(); @@ -786,15 +789,12 @@ void CFrame::OnMotion(wxMouseEvent& event) if(IsFullScreen() && SConfig::GetInstance().m_LocalCoreStartupParameter.bAutoHideCursor) { m_iLastMotionTime = Common::Timer::GetDoubleTime(); - #ifdef _WIN32 MSWSetCursor(true); - #endif return; } if(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && event.GetId() == IDM_MPANEL) { - #ifdef _WIN32 if(bRenderToMain) MSWSetCursor(false); /* We only need to use this if we are rendering to a separate window. It does work @@ -802,22 +802,20 @@ void CFrame::OnMotion(wxMouseEvent& event) so we can use that instead. If we one day determine that the separate window rendering is superfluous we could do without this */ else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 0); - #endif } // For some reason we need this to, otherwise the cursor can get stuck with the resizing arrows else { - #ifdef _WIN32 if(bRenderToMain) MSWSetCursor(true); else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 1); - #endif } } +#endif // Check for mouse status a couple of times per second for the auto hide option -#if wxUSE_TIMER +#if wxUSE_TIMER && defined _WIN32 void CFrame::Update() { // Check if auto hide is on, or if we are already hiding the cursor all the time @@ -830,10 +828,8 @@ void CFrame::Update() double TmpSeconds = Common::Timer::GetDoubleTime(); // Get timestamp double CompareTime = TmpSeconds - HideDelay; // Compare it - #ifdef _WIN32 if(m_iLastMotionTime < CompareTime) // Update cursor MSWSetCursor(false); - #endif } } #endif diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 54052ea4e0..a16050408e 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -337,10 +337,10 @@ class CFrame : public wxFrame void BootGame(const std::string& filename); // Double click and mouse move options + #if wxUSE_TIMER && defined _WIN32 double m_fLastClickTime, m_iLastMotionTime; int LastMouseX, LastMouseY; - #if wxUSE_TIMER void Update(); void OnTimer(wxTimerEvent& WXUNUSED(event)) { Update(); } wxTimer m_timer;