From 967c5891e9b40d4c933265c7978b7f85f80db6b0 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Wed, 17 Feb 2010 23:44:07 +0000 Subject: [PATCH] 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 --- Source/Core/Core/Src/Core.cpp | 6 ++++-- Source/Core/DolphinWX/Src/Frame.cpp | 3 +++ Source/Core/DolphinWX/Src/Main.cpp | 3 ++- Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp | 11 ++++++----- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 6e38a658eb..c77ba1c6d0 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -269,6 +269,8 @@ void ProcessXEvents(void) key = XLookupKeysym((XKeyEvent*)&event, 0); if(key == XK_F4 && ((event.xkey.state & Mod1Mask) == Mod1Mask)) Host_Message(WM_USER_STOP); + else if (key == XK_Escape) + Host_Message(WM_USER_PAUSE); break; case ClientMessage: 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 // 0x1b == VK_ESCAPE if (key == 0x1b) - { Host_Message(WM_USER_STOP); - } + if (key == 0x1c) + Host_Message(WM_USER_PAUSE); #endif } diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 48b254382e..ab4a411e5f 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -655,6 +655,9 @@ void CFrame::OnHostMessage(wxCommandEvent& event) case WM_USER_STOP: main_frame->DoStop(); break; + case WM_USER_PAUSE: + main_frame->OnPlay(event); + break; #endif } } diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 6735489ef6..9b5ecf3f9b 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -537,8 +537,9 @@ void Host_Message(int Id) switch(Id) { 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); break; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 48e8d2f1cc..50bf1ad47a 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -571,7 +571,7 @@ void OpenGL_Update() switch(event.type) { case KeyRelease: 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); FKeyPressed = -1; } else { @@ -592,6 +592,11 @@ void OpenGL_Update() } else if (key == XK_Return && ((event.xkey.state & Mod1Mask) == Mod1Mask)) ToggleFullscreenMode(); + else if (key == XK_Escape) + { + if (!GLWin.fs) + FKeyPressed = 0x1c; + } else { if(key == XK_Shift_L || key == XK_Shift_R) ShiftPressed = true; @@ -632,10 +637,6 @@ void OpenGL_Update() return; break; 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; } }