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) {
case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if (g_Config.bOSDHotKey)
{
switch (key)
{
case XK_3:
@ -79,11 +81,13 @@ void cX11Window::XEventThread()
g_Config.iEFBScale = g_Config.iEFBScale + 1;
if (g_Config.iEFBScale > 7) g_Config.iEFBScale = 0;
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
@ -97,13 +101,16 @@ void cX11Window::XEventThread()
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
}
break;
case XK_6:
OSDChoice = 4;
g_Config.bDisableFog = !g_Config.bDisableFog;
break;
default:
break;
}
}
if (g_Config.bFreeLook)
{
static float debugSpeed = 1.0f;

View File

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

View File

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