diff options
| author | Glenn Rice <glennricster@gmail.com> | 2010-03-08 23:29:16 +0000 |
|---|---|---|
| committer | Glenn Rice <glennricster@gmail.com> | 2010-03-08 23:29:16 +0000 |
| commit | 5beb6dfd4718c5580d4b90edf38ef7bd6882e0f4 (patch) | |
| tree | a738355b37d57758b9eeb04a902d8af7d059309d /Source/Core | |
| parent | a0952684b03e5d6e22a9b4c3eaa4b5f4069ee84f (diff) | |
Implement render to main in linux. In order to compile this in you will have to have libgtk2.0-dev (or your distributions equivalent) installed. If not dolphin-emu will still build, but without render to main operational.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5176 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinWX/Src/Frame.cpp | 56 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/Frame.h | 2 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/FrameTools.cpp | 5 |
3 files changed, 39 insertions, 24 deletions
diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index f038f0926b..d970fe86b8 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -523,10 +523,34 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event)) Close(true); } +#if defined HAVE_X11 && HAVE_X11 +void X11_SendEvent(const char *message) +{ + XEvent event; + Display *dpy = (Display *)Core::GetWindowHandle(); + Window win = *(Window *)Core::GetXWindow(); + + // Init X event structure for client message + event.xclient.type = ClientMessage; + event.xclient.format = 32; + event.xclient.data.l[0] = XInternAtom(dpy, message, False); + + // Send the event + if (!XSendEvent(dpy, win, False, False, &event)) + { + ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.\n", message); + } +} +#endif + // -------- // Events void CFrame::OnActive(wxActivateEvent& event) { +#if defined(HAVE_X11) && HAVE_X11 && defined(wxGTK) + if (event.GetActive() && Core::GetState() == Core::CORE_RUN) + X11_SendEvent("WINDOW_REFOCUS"); +#endif event.Skip(); } @@ -582,6 +606,7 @@ void CFrame::OnMove(wxMoveEvent& event) SConfig::GetInstance().m_LocalCoreStartupParameter.iPosX = GetPosition().x; SConfig::GetInstance().m_LocalCoreStartupParameter.iPosY = GetPosition().y; } + void CFrame::OnResize(wxSizeEvent& event) { event.Skip(); @@ -589,6 +614,11 @@ void CFrame::OnResize(wxSizeEvent& event) SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth(); SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight(); +#if defined(HAVE_X11) && HAVE_X11 + if (Core::GetState() == Core::CORE_RUN) + X11_SendEvent("MAIN_RESIZED"); +#endif + DoMoveIcons(); // In FrameWiimote.cpp } void CFrame::OnResizeAll(wxSizeEvent& event) @@ -653,7 +683,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event) main_frame->DoStop(); break; case WM_USER_PAUSE: - main_frame->OnPlay(event); + main_frame->DoPause(); break; #endif } @@ -910,31 +940,11 @@ wxAuiNotebook* CFrame::CreateEmptyNotebook() return NB; } -#if defined HAVE_X11 && HAVE_X11 -void X11_ShowFullScreen(bool bF) -{ - XEvent event; - Display *dpy = (Display *)Core::GetWindowHandle(); - Window win = *(Window *)Core::GetXWindow(); - - // Init X event structure for TOGGLE_FULLSCREEN client message - event.xclient.type = ClientMessage; - event.xclient.format = 32; - event.xclient.data.l[0] = XInternAtom(dpy, "TOGGLE_FULLSCREEN", False);; - - // Send the event - if (!XSendEvent(dpy, win, False, False, &event)) - { - ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.\n"); - } -} -#endif - void CFrame::DoFullscreen(bool bF) { #if defined HAVE_X11 && HAVE_X11 if ((Core::GetState() == Core::CORE_RUN)) - X11_ShowFullScreen(bF); + X11_SendEvent("TOGGLE_FULLSCREEN"); #endif // Only switch this to fullscreen if we're rendering to main AND if we're running a game // plus if a modal dialog is open, this will still process the keyboard events, and may cause @@ -1060,4 +1070,4 @@ void CFrame::ListTopWindows() j++; } NOTICE_LOG(CONSOLE, "\n"); -}
\ No newline at end of file +} diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 6d228a8618..21757a7072 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -64,6 +64,8 @@ class CFrame : public wxFrame { #ifdef _WIN32 return(m_Panel->GetHandle()); + #elif defined(HAVE_X11) && HAVE_X11 + return m_Panel; #else return this; #endif diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index f4eaae698b..50d710ed49 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -691,7 +691,10 @@ void CFrame::OnScreenshot(wxCommandEvent& WXUNUSED (event)) // Pause the emulation void CFrame::DoPause() { - Core::SetState(Core::CORE_PAUSE); + if (Core::GetState() == Core::CORE_RUN) + Core::SetState(Core::CORE_PAUSE); + else + Core::SetState(Core::CORE_RUN); UpdateGUI(); } |
