From d1a812231ee2b533434cbce9639f3e59413e1cd9 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Sun, 16 Dec 2012 21:32:14 -0600 Subject: [PATCH 1/8] Rework the way that windows mouse cursor hiding is done to use the built in wxWidgets methods. --- Source/Core/DolphinWX/Dolphin.vcxproj | 3 ++ Source/Core/DolphinWX/DolphinWX.rc | 1 + Source/Core/DolphinWX/Src/Frame.cpp | 52 ++++-------------------- Source/Core/DolphinWX/Src/FrameTools.cpp | 19 ++------- 4 files changed, 14 insertions(+), 61 deletions(-) diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj b/Source/Core/DolphinWX/Dolphin.vcxproj index 72c40a3db4..dc6aa2affa 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj +++ b/Source/Core/DolphinWX/Dolphin.vcxproj @@ -201,6 +201,9 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) + + C:\Archives\Dolphin-emu\dolphin-emu-git\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) + diff --git a/Source/Core/DolphinWX/DolphinWX.rc b/Source/Core/DolphinWX/DolphinWX.rc index e9c06a8fa9..e0c095c885 100644 --- a/Source/Core/DolphinWX/DolphinWX.rc +++ b/Source/Core/DolphinWX/DolphinWX.rc @@ -1,4 +1,5 @@ // Microsoft Visual C++ generated resource script. // #include "resource.h" +#include IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico" diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index da6c565ddf..99c4f65f1f 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -71,30 +71,7 @@ extern "C" { }; -// Windows functions. Setting the cursor with wxSetCursor() did not work in -// this instance. Probably because it's somehow reset from the WndProc() in -// the child window #ifdef _WIN32 -// Declare a blank icon and one that will be the normal cursor -HCURSOR hCursor = NULL, hCursorBlank = NULL; - -// Create the default cursor -void CreateCursor() -{ - hCursor = LoadCursor( NULL, IDC_ARROW ); -} - -void MSWSetCursor(bool Show) -{ - if(Show) - SetCursor(hCursor); - else - { - SetCursor(hCursorBlank); - //wxSetCursor(wxCursor(wxNullCursor)); - } -} - // I could not use FindItemByHWND() instead of this, it crashed on that occation I used it */ HWND MSWGetParent_(HWND Parent) { @@ -133,10 +110,11 @@ CPanel::CPanel( case WM_USER_SETCURSOR: if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && - main_frame->RendererHasFocus() && Core::GetState() == Core::CORE_RUN) - MSWSetCursor(!SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor); + main_frame->RendererHasFocus() && Core::GetState() == Core::CORE_RUN && + SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) + SetCursor(wxCURSOR_BLANK); else - MSWSetCursor(true); + SetCursor(wxCURSOR_ARROW); break; case WIIMOTE_DISCONNECT: @@ -435,9 +413,7 @@ CFrame::CFrame(wxFrame* parent, // Commit m_Mgr->Update(); - // Create cursors #ifdef _WIN32 - CreateCursor(); SetToolTip(wxT("")); GetToolTip()->SetAutoPop(25000); #endif @@ -494,20 +470,6 @@ void CFrame::OnActive(wxActivateEvent& event) { if (event.GetActive() && event.GetEventObject() == m_RenderFrame) { - // 32x32, 8bpp b/w image - // We want all transparent, so we can just use the same buffer for - // the "image" as for the transparency mask - static const char cursor_data[32 * 32] = { 0 }; - -#ifdef __WXGTK__ - wxCursor cursor_transparent = wxCursor(cursor_data, 32, 32, 6, 14, - cursor_data, wxWHITE, wxBLACK); -#else - wxBitmap cursor_bitmap(cursor_data, 32, 32); - cursor_bitmap.SetMask(new wxMask(cursor_bitmap)); - wxCursor cursor_transparent = wxCursor(cursor_bitmap.ConvertToImage()); -#endif - #ifdef __WXMSW__ ::SetFocus((HWND)m_RenderParent->GetHandle()); #else @@ -516,12 +478,12 @@ void CFrame::OnActive(wxActivateEvent& event) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && Core::GetState() == Core::CORE_RUN) - m_RenderParent->SetCursor(cursor_transparent); + m_RenderParent->SetCursor(wxCURSOR_BLANK); } else { if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) - m_RenderParent->SetCursor(wxNullCursor); + m_RenderParent->SetCursor(wxCURSOR_ARROW); } } event.Skip(); @@ -646,12 +608,12 @@ void CFrame::OnHostMessage(wxCommandEvent& event) } break; -#ifdef __WXGTK__ case WM_USER_CREATE: if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) m_RenderParent->SetCursor(wxCURSOR_BLANK); break; +#ifdef __WXGTK__ case IDM_PANIC: { wxString caption = event.GetString().BeforeFirst(':'); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 98649be181..d52427ed6e 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -139,9 +139,9 @@ void CFrame::CreateMenu() emulationMenu->Append(IDM_RECORDEXPORT, GetMenuLabel(HK_EXPORT_RECORDING)); emulationMenu->Append(IDM_RECORDREADONLY, GetMenuLabel(HK_READ_ONLY_MODE), wxEmptyString, wxITEM_CHECK); emulationMenu->Append(IDM_TASINPUT, _("TAS Input")); - emulationMenu->AppendCheckItem(IDM_TOGGLE_PAUSEMOVIE, _("Pause at end of movie")); + emulationMenu->AppendCheckItem(IDM_TOGGLE_PAUSEMOVIE, _("Pause at end of movie")); emulationMenu->Check(IDM_TOGGLE_PAUSEMOVIE, SConfig::GetInstance().m_PauseMovie); - emulationMenu->AppendCheckItem(IDM_SHOWLAG, _("Show lag counter")); + emulationMenu->AppendCheckItem(IDM_SHOWLAG, _("Show lag counter")); emulationMenu->Check(IDM_SHOWLAG, SConfig::GetInstance().m_ShowLag); emulationMenu->Check(IDM_RECORDREADONLY, true); emulationMenu->AppendSeparator(); @@ -1059,23 +1059,10 @@ void CFrame::DoPause() } else { - // 32x32, 8bpp b/w image - // We want all transparent, so we can just use the same buffer for - // the "image" as for the transparency mask - static const char cursor_data[32 * 32] = { 0 }; -#ifdef __WXGTK__ - wxCursor cursor_transparent = wxCursor(cursor_data, 32, 32, 6, 14, - cursor_data, wxWHITE, wxBLACK); -#else - wxBitmap cursor_bitmap(cursor_data, 32, 32); - cursor_bitmap.SetMask(new wxMask(cursor_bitmap)); - wxCursor cursor_transparent = wxCursor(cursor_bitmap.ConvertToImage()); -#endif - Core::SetState(Core::CORE_RUN); if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && RendererHasFocus()) - m_RenderParent->SetCursor(cursor_transparent); + m_RenderParent->SetCursor(wxCURSOR_BLANK); } UpdateGUI(); } From a581c75a37c45073acc5dda0caacb95e39928ed5 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Sun, 16 Dec 2012 22:52:29 -0600 Subject: [PATCH 2/8] Make the resource include path relative. --- Source/Core/DolphinWX/Dolphin.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj b/Source/Core/DolphinWX/Dolphin.vcxproj index dc6aa2affa..1ddf0a94cf 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj +++ b/Source/Core/DolphinWX/Dolphin.vcxproj @@ -202,7 +202,7 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) - C:\Archives\Dolphin-emu\dolphin-emu-git\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) + ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) @@ -390,4 +390,4 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / - \ No newline at end of file + From d34fb84734f00074c7bcf0edf70f6e6fcdab450e Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Sun, 16 Dec 2012 23:21:11 -0600 Subject: [PATCH 3/8] Add the resource inclusion to the other builds. --- Source/Core/DolphinWX/Dolphin.vcxproj | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj b/Source/Core/DolphinWX/Dolphin.vcxproj index 1ddf0a94cf..84295733da 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj +++ b/Source/Core/DolphinWX/Dolphin.vcxproj @@ -155,6 +155,9 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) + + ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) + @@ -171,6 +174,9 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) + + ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) + @@ -202,7 +208,7 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) - ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) + ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) @@ -218,6 +224,9 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) + + ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) + @@ -390,4 +399,4 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / - + \ No newline at end of file From 832a5a0b26a61e76f5b67cd6ec6f5b4945aafbe1 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Sun, 16 Dec 2012 23:39:05 -0600 Subject: [PATCH 4/8] Add the resource include in only one place for all builds. --- Source/Core/DolphinWX/Dolphin.vcxproj | 12 +----------- Source/VSProps/Base.props | 3 +++ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj b/Source/Core/DolphinWX/Dolphin.vcxproj index 84295733da..1556eb5687 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj +++ b/Source/Core/DolphinWX/Dolphin.vcxproj @@ -155,9 +155,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) - - ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) - @@ -174,9 +171,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) - - ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) - @@ -208,7 +202,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) - ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) @@ -224,9 +217,6 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Copying Data\* to $(TargetDir) - - ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) - @@ -399,4 +389,4 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / - \ No newline at end of file + diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 4bd98b9d70..bb2f7e6efa 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -20,6 +20,9 @@ true 0x00400000 + + ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) + \ No newline at end of file From ff7041804c0974a858747a6e8febfcea544a5ecc Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Sun, 16 Dec 2012 23:55:22 -0600 Subject: [PATCH 5/8] Make sure that the wxWidgets manifest does not override the dolphin one. --- Source/Core/DolphinWX/DolphinWX.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/DolphinWX/DolphinWX.rc b/Source/Core/DolphinWX/DolphinWX.rc index e0c095c885..960758e696 100644 --- a/Source/Core/DolphinWX/DolphinWX.rc +++ b/Source/Core/DolphinWX/DolphinWX.rc @@ -1,5 +1,6 @@ // Microsoft Visual C++ generated resource script. // #include "resource.h" +#define wxUSE_NO_MANIFEST 1 #include IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico" From 0a918782cfd430620776cb8f84699147b617a1d3 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Mon, 17 Dec 2012 00:11:59 -0600 Subject: [PATCH 6/8] Reorder the inclusions to hopefully fix the icon issue. --- Source/Core/DolphinWX/DolphinWX.rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/DolphinWX.rc b/Source/Core/DolphinWX/DolphinWX.rc index 960758e696..6a992a7e74 100644 --- a/Source/Core/DolphinWX/DolphinWX.rc +++ b/Source/Core/DolphinWX/DolphinWX.rc @@ -1,6 +1,7 @@ // Microsoft Visual C++ generated resource script. // #include "resource.h" +IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico" #define wxUSE_NO_MANIFEST 1 #include -IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico" + From f1cc5c2ff9f41582bfa7c2cbab4ee0167cdb6451 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Mon, 17 Dec 2012 08:33:42 -0600 Subject: [PATCH 7/8] Define the icon for "dolphin". The IDI_ICON1 seems to be preempted by the wx resource. This one does not. --- Source/Core/DolphinWX/DolphinWX.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Core/DolphinWX/DolphinWX.rc b/Source/Core/DolphinWX/DolphinWX.rc index 6a992a7e74..550e08c35a 100644 --- a/Source/Core/DolphinWX/DolphinWX.rc +++ b/Source/Core/DolphinWX/DolphinWX.rc @@ -2,6 +2,7 @@ // #include "resource.h" IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico" +"dolphin" ICON "..\\..\\..\\Installer\\Dolphin.ico" #define wxUSE_NO_MANIFEST 1 #include From 98ed34d50b158e4a6a88ca309d2904b714964d5b Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Mon, 17 Dec 2012 11:32:10 -0600 Subject: [PATCH 8/8] Use wxNullCursor to put the cursor back to its default instead of explicitly setting the cursor to the arrow. --- Source/Core/DolphinWX/Src/Frame.cpp | 4 ++-- Source/Core/DolphinWX/Src/FrameTools.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 99c4f65f1f..c9408203ea 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -114,7 +114,7 @@ CPanel::CPanel( SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) SetCursor(wxCURSOR_BLANK); else - SetCursor(wxCURSOR_ARROW); + SetCursor(wxNullCursor); break; case WIIMOTE_DISCONNECT: @@ -483,7 +483,7 @@ void CFrame::OnActive(wxActivateEvent& event) else { if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) - m_RenderParent->SetCursor(wxCURSOR_ARROW); + m_RenderParent->SetCursor(wxNullCursor); } } event.Skip(); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index d52427ed6e..db2d591308 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -1055,7 +1055,7 @@ void CFrame::DoPause() { Core::SetState(Core::CORE_PAUSE); if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) - m_RenderParent->SetCursor(wxCURSOR_ARROW); + m_RenderParent->SetCursor(wxNullCursor); } else { @@ -1138,7 +1138,7 @@ void CFrame::DoStop() wxMouseEventHandler(CFrame::OnMouse), (wxObject*)0, this); if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) - m_RenderParent->SetCursor(wxCURSOR_ARROW); + m_RenderParent->SetCursor(wxNullCursor); DoFullscreen(false); if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) m_RenderFrame->Destroy();