Make the Escape key pause the emulator in linux when not in fullscreen.

I believe this is the same as in windows?


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5078 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-02-17 23:44:07 +00:00
parent 2c7b484869
commit 967c5891e9
4 changed files with 15 additions and 8 deletions

View File

@ -269,6 +269,8 @@ void ProcessXEvents(void)
key = XLookupKeysym((XKeyEvent*)&event, 0); key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key == XK_F4 && ((event.xkey.state & Mod1Mask) == Mod1Mask)) if(key == XK_F4 && ((event.xkey.state & Mod1Mask) == Mod1Mask))
Host_Message(WM_USER_STOP); Host_Message(WM_USER_STOP);
else if (key == XK_Escape)
Host_Message(WM_USER_PAUSE);
break; break;
case ClientMessage: case ClientMessage:
if ((ulong) event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False)) if ((ulong) event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False))
@ -820,9 +822,9 @@ void Callback_KeyPress(int key, bool shift, bool control)
#if defined(HAVE_X11) && HAVE_X11 #if defined(HAVE_X11) && HAVE_X11
// 0x1b == VK_ESCAPE // 0x1b == VK_ESCAPE
if (key == 0x1b) if (key == 0x1b)
{
Host_Message(WM_USER_STOP); Host_Message(WM_USER_STOP);
} if (key == 0x1c)
Host_Message(WM_USER_PAUSE);
#endif #endif
} }

View File

@ -655,6 +655,9 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
case WM_USER_STOP: case WM_USER_STOP:
main_frame->DoStop(); main_frame->DoStop();
break; break;
case WM_USER_PAUSE:
main_frame->OnPlay(event);
break;
#endif #endif
} }
} }

View File

@ -537,8 +537,9 @@ void Host_Message(int Id)
switch(Id) switch(Id)
{ {
case WM_USER_STOP: case WM_USER_STOP:
case WM_USER_PAUSE:
{ {
wxCommandEvent event(wxEVT_HOST_COMMAND, WM_USER_STOP); wxCommandEvent event(wxEVT_HOST_COMMAND, Id);
main_frame->GetEventHandler()->AddPendingEvent(event); main_frame->GetEventHandler()->AddPendingEvent(event);
break; break;
} }

View File

@ -571,7 +571,7 @@ void OpenGL_Update()
switch(event.type) { switch(event.type) {
case KeyRelease: case KeyRelease:
key = XLookupKeysym((XKeyEvent*)&event, 0); key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key >= XK_F1 && key <= XK_F9) { if((key >= XK_F1 && key <= XK_F9) || key == XK_Escape) {
g_VideoInitialize.pKeyPress(FKeyPressed, ShiftPressed, ControlPressed); g_VideoInitialize.pKeyPress(FKeyPressed, ShiftPressed, ControlPressed);
FKeyPressed = -1; FKeyPressed = -1;
} else { } else {
@ -592,6 +592,11 @@ void OpenGL_Update()
} }
else if (key == XK_Return && ((event.xkey.state & Mod1Mask) == Mod1Mask)) else if (key == XK_Return && ((event.xkey.state & Mod1Mask) == Mod1Mask))
ToggleFullscreenMode(); ToggleFullscreenMode();
else if (key == XK_Escape)
{
if (!GLWin.fs)
FKeyPressed = 0x1c;
}
else { else {
if(key == XK_Shift_L || key == XK_Shift_R) if(key == XK_Shift_L || key == XK_Shift_R)
ShiftPressed = true; ShiftPressed = true;
@ -632,10 +637,6 @@ void OpenGL_Update()
return; return;
break; break;
default: default:
//TODO: Should we put the event back if we don't handle it?
// I think we handle all the needed ones, the rest shouldn't matter
// But to be safe, let's but them back anyway
//XPutBackEvent(GLWin.dpy, &event);
break; break;
} }
} }