Enable the OSD hotkeys in linux

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5147 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-02-28 21:56:17 +00:00
parent 3116a7ea1b
commit 8035ccaef4
2 changed files with 68 additions and 22 deletions

View File

@ -566,30 +566,75 @@ void OpenGL_Update()
switch(event.type) {
case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key >= XK_F1 && key <= XK_F9)
switch (key)
{
if(key == XK_F4 && ((event.xkey.state & Mod1Mask) == Mod1Mask))
g_VideoInitialize.pKeyPress(0x1b, False, False);
else
case XK_F4:
if(event.xkey.state & Mod1Mask)
{
g_VideoInitialize.pKeyPress(0x1b, False, False);
break;
}
case XK_F1: case XK_F2: case XK_F3: case XK_F5:
case XK_F6: case XK_F7: case XK_F8: case XK_F9:
g_VideoInitialize.pKeyPress(key - 0xff4e,
(event.xkey.state & ShiftMask) == ShiftMask,
(event.xkey.state & ControlMask) == ControlMask);
event.xkey.state & ShiftMask,
event.xkey.state & ControlMask);
break;
case XK_Escape:
if (GLWin.fs)
{
ToggleFullscreenMode();
XEvent mapevent;
do {
XMaskEvent(GLWin.dpy, StructureNotifyMask, &mapevent);
} while ( (mapevent.type != MapNotify) || (mapevent.xmap.event != GLWin.win) );
}
g_VideoInitialize.pKeyPress(0x1c, False, False);
break;
case XK_Return:
if (event.xkey.state & Mod1Mask)
ToggleFullscreenMode();
break;
case XK_3:
OSDChoice = 1;
// Toggle native resolution
if (!(g_Config.bNativeResolution || g_Config.b2xResolution))
g_Config.bNativeResolution = true;
else if (g_Config.bNativeResolution && Renderer::AllowCustom())
{ g_Config.bNativeResolution = false; if (Renderer::Allow2x()) {g_Config.b2xResolution = true;} }
else if (Renderer::AllowCustom())
g_Config.b2xResolution = false;
break;
case XK_4:
OSDChoice = 2;
// Toggle aspect ratio
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
break;
case XK_5:
OSDChoice = 3;
// Toggle EFB copy
if (g_Config.bEFBCopyDisable || g_Config.bCopyEFBToTexture)
{
g_Config.bEFBCopyDisable = !g_Config.bEFBCopyDisable;
g_Config.bCopyEFBToTexture = false;
}
else
{
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
}
break;
case XK_6:
OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog;
break;
case XK_7:
OSDChoice = 5;
g_Config.bDisableLighting = !g_Config.bDisableLighting;
break;
default:
break;
}
else if (key == XK_Escape)
{
if (GLWin.fs)
{
ToggleFullscreenMode();
XEvent mapevent;
do {
XMaskEvent(GLWin.dpy, StructureNotifyMask, &mapevent);
} while ( (mapevent.type != MapNotify) || (mapevent.xmap.event != GLWin.win) );
}
g_VideoInitialize.pKeyPress(0x1c, False, False);
}
else if (key == XK_Return && ((event.xkey.state & Mod1Mask) == Mod1Mask))
ToggleFullscreenMode();
break;
case FocusIn:
if (g_Config.bHideCursor)
XDefineCursor(GLWin.dpy, GLWin.win, GLWin.blankCursor);

View File

@ -416,8 +416,9 @@ void GFXConfigDialogOGL::CreateGUIControls()
sbBasicAdvanced = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Advanced Display Settings"));
m_RenderToMainWindow = new wxCheckBox(m_PageGeneral, ID_RENDERTOMAINWINDOW, wxT("Render to Main window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_OSDHotKey = new wxCheckBox(m_PageGeneral, ID_OSDHOTKEY, wxT("Enable Hotkeys"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
#ifndef _WIN32
#if !defined(_WIN32) && (!defined(HAVE_X11) || !HAVE_X11)
// JPeterson set the hot key to be Win32-specific
// Now linux has this (with X11)
m_OSDHotKey->Enable(false);
#endif
m_VSync = new wxCheckBox(m_PageGeneral, ID_VSYNC, wxT("VSync (req. restart)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);