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
This commit is contained in:
parent
d6b9a2ec81
commit
a7b03fd2cd
|
@ -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)
|
||||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue