From 35a5a3b9d437f6150cfdfe45fefcb922cdd7d52b Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 19 Mar 2012 06:54:02 -0700 Subject: Fix "Hid cursor" causing a wxWidgets warning --- Source/Core/DolphinWX/Src/Frame.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'Source/Core/DolphinWX/Src/Frame.cpp') diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index e7c4fca067..a089562743 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -500,19 +500,32 @@ void CFrame::OnActive(wxActivateEvent& event) { if (event.GetActive() && event.GetEventObject() == m_RenderFrame) { -#ifdef _WIN32 + // 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 __WXMSW__ + wxBitmap cursor_bitmap(cursor_data, 32, 32); + cursor_bitmap.SetMask(new wxMask(cursor_bitmap)); + wxCursor cursor_transparent = wxCursor(cursor_bitmap.ConvertToImage()); + ::SetFocus((HWND)m_RenderParent->GetHandle()); #else + wxCursor cursor_transparent = wxCursor(cursor_data, 32, 32, 6, 14, + cursor_data, wxWHITE, wxBLACK); + m_RenderParent->SetFocus(); #endif + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && Core::GetState() == Core::CORE_RUN) - m_RenderParent->SetCursor(wxCURSOR_BLANK); + m_RenderParent->SetCursor(cursor_transparent); } else { if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) - m_RenderParent->SetCursor(wxCURSOR_ARROW); + m_RenderParent->SetCursor(wxNullCursor); } } event.Skip(); @@ -629,11 +642,6 @@ void CFrame::OnHostMessage(wxCommandEvent& event) m_RenderFrame->SetTitle(event.GetString()); break; - case WM_USER_CREATE: - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) - m_RenderParent->SetCursor(wxCURSOR_BLANK); - break; - case IDM_WINDOWSIZEREQUEST: { std::pair *win_size = (std::pair *)(event.GetClientData()); -- cgit v1.2.3 From 05c964e6d60cef5a6d49f69213b50f1720468f2f Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 19 Mar 2012 07:39:04 -0700 Subject: wxw3: OSX can use the same method of hiding cursors as MSW --- Source/Core/DolphinWX/Src/Frame.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Source/Core/DolphinWX/Src/Frame.cpp') diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index a089562743..d8ed54087f 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -504,20 +504,21 @@ void CFrame::OnActive(wxActivateEvent& event) // 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); -#ifdef __WXMSW__ + m_RenderParent->SetFocus(); +#else wxBitmap cursor_bitmap(cursor_data, 32, 32); cursor_bitmap.SetMask(new wxMask(cursor_bitmap)); wxCursor cursor_transparent = wxCursor(cursor_bitmap.ConvertToImage()); - +#ifdef __WXMSW__ ::SetFocus((HWND)m_RenderParent->GetHandle()); -#else - wxCursor cursor_transparent = wxCursor(cursor_data, 32, 32, 6, 14, - cursor_data, wxWHITE, wxBLACK); - - m_RenderParent->SetFocus(); #endif - +#endif + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && Core::GetState() == Core::CORE_RUN) m_RenderParent->SetCursor(cursor_transparent); -- cgit v1.2.3 From 4a1e8ba30a974d7a852e1ac4657da2c7bc9f7c65 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 19 Mar 2012 07:46:23 -0700 Subject: sigh...fix #ifdefs in last commit... --- Source/Core/DolphinWX/Src/Frame.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Source/Core/DolphinWX/Src/Frame.cpp') diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index d8ed54087f..f9f0cec412 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -508,15 +508,16 @@ void CFrame::OnActive(wxActivateEvent& event) #ifdef __WXGTK__ wxCursor cursor_transparent = wxCursor(cursor_data, 32, 32, 6, 14, cursor_data, wxWHITE, wxBLACK); - - m_RenderParent->SetFocus(); #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()); -#endif +#else + m_RenderParent->SetFocus(); #endif if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor && -- cgit v1.2.3 From 40640217f17cc03c8f7195b52aaecb674f3507f3 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Wed, 2 May 2012 14:40:40 -0500 Subject: Fix hide mouse cursor on linux. Fix emulator window position when rendering to main on linux. Allow building against wxWidgets 2.9.3 on linux. --- Source/Core/DolphinWX/Src/Frame.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'Source/Core/DolphinWX/Src/Frame.cpp') diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index f9f0cec412..93e0cf8f15 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -653,6 +653,11 @@ void CFrame::OnHostMessage(wxCommandEvent& event) break; #ifdef __WXGTK__ + case WM_USER_CREATE: + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor) + m_RenderParent->SetCursor(wxCURSOR_BLANK); + break; + case IDM_PANIC: { wxString caption = event.GetString().BeforeFirst(':'); @@ -676,8 +681,11 @@ void CFrame::GetRenderWindowSize(int& x, int& y, int& width, int& height) if (!wxIsMainThread()) wxMutexGuiEnter(); #endif - m_RenderParent->GetClientSize(&width, &height); - m_RenderParent->GetPosition(&x, &y); + wxRect client_rect = m_RenderParent->GetClientRect(); + width = client_rect.width; + height = client_rect.height; + x = client_rect.x; + y = client_rect.y; #ifdef __WXGTK__ if (!wxIsMainThread()) wxMutexGuiLeave(); -- cgit v1.2.3