Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'rehash-msw-cursor-hide'
  • Loading branch information
glennricster committed Dec 18, 2012
2 parents 512cae6 + 98ed34d commit 1bd42b7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 63 deletions.
4 changes: 3 additions & 1 deletion Source/Core/DolphinWX/Dolphin.vcxproj
Expand Up @@ -201,6 +201,8 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
</Command>
<Message>Copying Data\* to $(TargetDir)</Message>
</PostBuildEvent>
<ResourceCompile>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">
<ClCompile>
Expand Down Expand Up @@ -387,4 +389,4 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
4 changes: 4 additions & 0 deletions Source/Core/DolphinWX/DolphinWX.rc
Expand Up @@ -2,3 +2,7 @@
//
#include "resource.h"
IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico"
"dolphin" ICON "..\\..\\..\\Installer\\Dolphin.ico"
#define wxUSE_NO_MANIFEST 1
#include <wx/msw/wx.rc>

50 changes: 6 additions & 44 deletions Source/Core/DolphinWX/Src/Frame.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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(wxNullCursor);
break;

case WIIMOTE_DISCONNECT:
Expand Down Expand Up @@ -435,9 +413,7 @@ CFrame::CFrame(wxFrame* parent,
// Commit
m_Mgr->Update();

// Create cursors
#ifdef _WIN32
CreateCursor();
SetToolTip(wxT(""));
GetToolTip()->SetAutoPop(25000);
#endif
Expand Down Expand Up @@ -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
Expand All @@ -516,7 +478,7 @@ 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
{
Expand Down Expand Up @@ -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(':');
Expand Down
23 changes: 5 additions & 18 deletions Source/Core/DolphinWX/Src/FrameTools.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -1055,27 +1055,14 @@ void CFrame::DoPause()
{
Core::SetState(Core::CORE_PAUSE);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_ARROW);
m_RenderParent->SetCursor(wxNullCursor);
}
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();
}
Expand Down Expand Up @@ -1151,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();
Expand Down
3 changes: 3 additions & 0 deletions Source/VSProps/Base.props
Expand Up @@ -20,6 +20,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<BaseAddress>0x00400000</BaseAddress>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

0 comments on commit 1bd42b7

Please sign in to comment.