Merge branch 'rehash-msw-cursor-hide'

This commit is contained in:
Glenn Rice 2012-12-18 08:07:47 -06:00
commit 1bd42b7acc
5 changed files with 21 additions and 63 deletions

View File

@ -201,6 +201,8 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
</Command> </Command>
<Message>Copying Data\* to $(TargetDir)</Message> <Message>Copying Data\* to $(TargetDir)</Message>
</PostBuildEvent> </PostBuildEvent>
<ResourceCompile>
</ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">
<ClCompile> <ClCompile>

View File

@ -2,3 +2,7 @@
// //
#include "resource.h" #include "resource.h"
IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico" IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico"
"dolphin" ICON "..\\..\\..\\Installer\\Dolphin.ico"
#define wxUSE_NO_MANIFEST 1
#include <wx/msw/wx.rc>

View File

@ -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 #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 */ // I could not use FindItemByHWND() instead of this, it crashed on that occation I used it */
HWND MSWGetParent_(HWND Parent) HWND MSWGetParent_(HWND Parent)
{ {
@ -133,10 +110,11 @@ CPanel::CPanel(
case WM_USER_SETCURSOR: case WM_USER_SETCURSOR:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
main_frame->RendererHasFocus() && Core::GetState() == Core::CORE_RUN) main_frame->RendererHasFocus() && Core::GetState() == Core::CORE_RUN &&
MSWSetCursor(!SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor); SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
SetCursor(wxCURSOR_BLANK);
else else
MSWSetCursor(true); SetCursor(wxNullCursor);
break; break;
case WIIMOTE_DISCONNECT: case WIIMOTE_DISCONNECT:
@ -435,9 +413,7 @@ CFrame::CFrame(wxFrame* parent,
// Commit // Commit
m_Mgr->Update(); m_Mgr->Update();
// Create cursors
#ifdef _WIN32 #ifdef _WIN32
CreateCursor();
SetToolTip(wxT("")); SetToolTip(wxT(""));
GetToolTip()->SetAutoPop(25000); GetToolTip()->SetAutoPop(25000);
#endif #endif
@ -494,20 +470,6 @@ void CFrame::OnActive(wxActivateEvent& event)
{ {
if (event.GetActive() && event.GetEventObject() == m_RenderFrame) 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__ #ifdef __WXMSW__
::SetFocus((HWND)m_RenderParent->GetHandle()); ::SetFocus((HWND)m_RenderParent->GetHandle());
#else #else
@ -516,7 +478,7 @@ void CFrame::OnActive(wxActivateEvent& event)
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
Core::GetState() == Core::CORE_RUN) Core::GetState() == Core::CORE_RUN)
m_RenderParent->SetCursor(cursor_transparent); m_RenderParent->SetCursor(wxCURSOR_BLANK);
} }
else else
{ {
@ -646,12 +608,12 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
} }
break; break;
#ifdef __WXGTK__
case WM_USER_CREATE: case WM_USER_CREATE:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_BLANK); m_RenderParent->SetCursor(wxCURSOR_BLANK);
break; break;
#ifdef __WXGTK__
case IDM_PANIC: case IDM_PANIC:
{ {
wxString caption = event.GetString().BeforeFirst(':'); wxString caption = event.GetString().BeforeFirst(':');

View File

@ -1055,27 +1055,14 @@ void CFrame::DoPause()
{ {
Core::SetState(Core::CORE_PAUSE); Core::SetState(Core::CORE_PAUSE);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_ARROW); m_RenderParent->SetCursor(wxNullCursor);
} }
else 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); Core::SetState(Core::CORE_RUN);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
RendererHasFocus()) RendererHasFocus())
m_RenderParent->SetCursor(cursor_transparent); m_RenderParent->SetCursor(wxCURSOR_BLANK);
} }
UpdateGUI(); UpdateGUI();
} }
@ -1151,7 +1138,7 @@ void CFrame::DoStop()
wxMouseEventHandler(CFrame::OnMouse), wxMouseEventHandler(CFrame::OnMouse),
(wxObject*)0, this); (wxObject*)0, this);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_ARROW); m_RenderParent->SetCursor(wxNullCursor);
DoFullscreen(false); DoFullscreen(false);
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
m_RenderFrame->Destroy(); m_RenderFrame->Destroy();

View File

@ -20,6 +20,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<BaseAddress>0x00400000</BaseAddress> <BaseAddress>0x00400000</BaseAddress>
</Link> </Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup /> <ItemGroup />
</Project> </Project>