X11: Disable OSD hotkeys when the corresponding option is disabled.

This commit is contained in:
NeoBrainX 2012-12-31 16:21:23 +01:00
parent 446d9279b1
commit 09197e0ffc
3 changed files with 142 additions and 131 deletions

View File

@ -71,6 +71,8 @@ void cX11Window::XEventThread()
switch(event.type) { switch(event.type) {
case KeyPress: case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0); key = XLookupKeysym((XKeyEvent*)&event, 0);
if (g_Config.bOSDHotKey)
{
switch (key) switch (key)
{ {
case XK_3: case XK_3:
@ -79,11 +81,13 @@ void cX11Window::XEventThread()
g_Config.iEFBScale = g_Config.iEFBScale + 1; g_Config.iEFBScale = g_Config.iEFBScale + 1;
if (g_Config.iEFBScale > 7) g_Config.iEFBScale = 0; if (g_Config.iEFBScale > 7) g_Config.iEFBScale = 0;
break; break;
case XK_4: case XK_4:
OSDChoice = 2; OSDChoice = 2;
// Toggle aspect ratio // Toggle aspect ratio
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3; g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
break; break;
case XK_5: case XK_5:
OSDChoice = 3; OSDChoice = 3;
// Toggle EFB copy // Toggle EFB copy
@ -97,13 +101,16 @@ void cX11Window::XEventThread()
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture; g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
} }
break; break;
case XK_6: case XK_6:
OSDChoice = 4; OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog; g_Config.bDisableFog = !g_Config.bDisableFog;
break; break;
default: default:
break; break;
} }
}
if (g_Config.bFreeLook) if (g_Config.bFreeLook)
{ {
static float debugSpeed = 1.0f; static float debugSpeed = 1.0f;

View File

@ -91,6 +91,9 @@ Renderer::Renderer() : frame_data(NULL), bLastFrameDumped(false)
#if defined _WIN32 || defined HAVE_LIBAV #if defined _WIN32 || defined HAVE_LIBAV
bAVIDumping = false; bAVIDumping = false;
#endif #endif
OSDChoice = 0;
OSDTime = 0;
} }
Renderer::~Renderer() Renderer::~Renderer()
@ -263,16 +266,19 @@ void Renderer::SetScreenshot(const char *filename)
// Create On-Screen-Messages // Create On-Screen-Messages
void Renderer::DrawDebugText() void Renderer::DrawDebugText()
{ {
if (!g_Config.bOSDHotKey)
return;
// OSD Menu messages // OSD Menu messages
if (g_ActiveConfig.bOSDHotKey)
{
if (OSDChoice > 0) if (OSDChoice > 0)
{ {
OSDTime = Common::Timer::GetTimeMs() + 3000; OSDTime = Common::Timer::GetTimeMs() + 3000;
OSDChoice = -OSDChoice; OSDChoice = -OSDChoice;
} }
if ((u32)OSDTime > Common::Timer::GetTimeMs())
{ if ((u32)OSDTime <= Common::Timer::GetTimeMs())
return;
const char* res_text = ""; const char* res_text = "";
switch (g_ActiveConfig.iEFBScale) switch (g_ActiveConfig.iEFBScale)
{ {
@ -363,8 +369,6 @@ void Renderer::DrawDebugText()
//and then the text //and then the text
g_renderer->RenderText(final_cyan.c_str(), 20, 20, 0xFF00FFFF); g_renderer->RenderText(final_cyan.c_str(), 20, 20, 0xFF00FFFF);
g_renderer->RenderText(final_yellow.c_str(), 20, 20, 0xFFFFFF00); g_renderer->RenderText(final_yellow.c_str(), 20, 20, 0xFFFFFF00);
}
}
} }
// TODO: remove // TODO: remove

View File

@ -39,7 +39,7 @@
// TODO: Move these out of here. // TODO: Move these out of here.
extern int frameCount; extern int frameCount;
extern int OSDChoice, OSDTime; extern int OSDChoice;
extern bool bLastFrameDumped; extern bool bLastFrameDumped;