summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorGlenn Rice <glennricster@gmail.com>2010-03-16 13:30:52 +0000
committerGlenn Rice <glennricster@gmail.com>2010-03-16 13:30:52 +0000
commita7b03fd2cd91b2f194ec34e25f043fb65f3dc33f (patch)
tree4be3abdeefc041a7220ed8afc622fbe94d31395b /Source/Core
parentd6b9a2ec814565b2e1ca4c42782a98b303b11e91 (diff)
Implement pausing (with the Escape key) for the NoGUI build in linux.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5203 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/Src/MainNoGUI.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp
index d30ab1113e..b139c48cf8 100644
--- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp
+++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp
@@ -58,12 +58,46 @@ void Host_NotifyMapLoaded(){}
void Host_ShowJitResults(unsigned int address){}
+#if defined(HAVE_X11) && HAVE_X11
+void X11_SendClientEvent(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
+
Common::Event updateMainFrameEvent;
void Host_Message(int Id)
{
#if defined(HAVE_X11) && HAVE_X11
- if (Id == WM_USER_STOP)
- updateMainFrameEvent.Set();
+ switch (Id)
+ {
+ case WM_USER_STOP:
+ updateMainFrameEvent.Set();
+ break;
+ case WM_USER_PAUSE:
+ if (Core::GetState() == Core::CORE_RUN)
+ {
+ X11_SendClientEvent("PAUSE");
+ Core::SetState(Core::CORE_PAUSE);
+ }
+ else
+ {
+ X11_SendClientEvent("RESUME");
+ Core::SetState(Core::CORE_RUN);
+ }
+ break;
+ }
#endif
}