mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-02 02:52:30 +02:00
X11: Disable OSD hotkeys when the corresponding option is disabled.
This commit is contained in:
parent
446d9279b1
commit
09197e0ffc
@ -71,38 +71,45 @@ void cX11Window::XEventThread()
|
|||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||||
switch (key)
|
if (g_Config.bOSDHotKey)
|
||||||
{
|
{
|
||||||
case XK_3:
|
switch (key)
|
||||||
OSDChoice = 1;
|
{
|
||||||
// Toggle native resolution
|
case XK_3:
|
||||||
g_Config.iEFBScale = g_Config.iEFBScale + 1;
|
OSDChoice = 1;
|
||||||
if (g_Config.iEFBScale > 7) g_Config.iEFBScale = 0;
|
// Toggle native resolution
|
||||||
break;
|
g_Config.iEFBScale = g_Config.iEFBScale + 1;
|
||||||
case XK_4:
|
if (g_Config.iEFBScale > 7) g_Config.iEFBScale = 0;
|
||||||
OSDChoice = 2;
|
break;
|
||||||
// Toggle aspect ratio
|
|
||||||
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
|
case XK_4:
|
||||||
break;
|
OSDChoice = 2;
|
||||||
case XK_5:
|
// Toggle aspect ratio
|
||||||
OSDChoice = 3;
|
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
|
||||||
// Toggle EFB copy
|
break;
|
||||||
if (!g_Config.bEFBCopyEnable || g_Config.bCopyEFBToTexture)
|
|
||||||
{
|
case XK_5:
|
||||||
g_Config.bEFBCopyEnable ^= true;
|
OSDChoice = 3;
|
||||||
g_Config.bCopyEFBToTexture = false;
|
// Toggle EFB copy
|
||||||
}
|
if (!g_Config.bEFBCopyEnable || g_Config.bCopyEFBToTexture)
|
||||||
else
|
{
|
||||||
{
|
g_Config.bEFBCopyEnable ^= true;
|
||||||
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
|
g_Config.bCopyEFBToTexture = false;
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
case XK_6:
|
{
|
||||||
OSDChoice = 4;
|
g_Config.bCopyEFBToTexture = !g_Config.bCopyEFBToTexture;
|
||||||
g_Config.bDisableFog = !g_Config.bDisableFog;
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
case XK_6:
|
||||||
|
OSDChoice = 4;
|
||||||
|
g_Config.bDisableFog = !g_Config.bDisableFog;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (g_Config.bFreeLook)
|
if (g_Config.bFreeLook)
|
||||||
{
|
{
|
||||||
|
@ -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,108 +266,109 @@ 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;
|
||||||
{
|
OSDChoice = -OSDChoice;
|
||||||
OSDTime = Common::Timer::GetTimeMs() + 3000;
|
|
||||||
OSDChoice = -OSDChoice;
|
|
||||||
}
|
|
||||||
if ((u32)OSDTime > Common::Timer::GetTimeMs())
|
|
||||||
{
|
|
||||||
const char* res_text = "";
|
|
||||||
switch (g_ActiveConfig.iEFBScale)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
res_text = "Auto (fractional)";
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
res_text = "Auto (integral)";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
res_text = "Native";
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
res_text = "1.5x";
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
res_text = "2x";
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
res_text = "2.5x";
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
res_text = "3x";
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
res_text = "4x";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* ar_text = "";
|
|
||||||
switch(g_ActiveConfig.iAspectRatio)
|
|
||||||
{
|
|
||||||
case ASPECT_AUTO:
|
|
||||||
ar_text = "Auto";
|
|
||||||
break;
|
|
||||||
case ASPECT_FORCE_16_9:
|
|
||||||
ar_text = "16:9";
|
|
||||||
break;
|
|
||||||
case ASPECT_FORCE_4_3:
|
|
||||||
ar_text = "4:3";
|
|
||||||
break;
|
|
||||||
case ASPECT_STRETCH:
|
|
||||||
ar_text = "Stretch";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ?
|
|
||||||
(g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled";
|
|
||||||
|
|
||||||
// The rows
|
|
||||||
const std::string lines[] =
|
|
||||||
{
|
|
||||||
std::string("3: Internal Resolution: ") + res_text,
|
|
||||||
std::string("4: Aspect Ratio: ") + ar_text + (g_ActiveConfig.bCrop ? " (crop)" : ""),
|
|
||||||
std::string("5: Copy EFB: ") + efbcopy_text,
|
|
||||||
std::string("6: Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"),
|
|
||||||
};
|
|
||||||
|
|
||||||
enum { lines_count = sizeof(lines)/sizeof(*lines) };
|
|
||||||
|
|
||||||
std::string final_yellow, final_cyan;
|
|
||||||
|
|
||||||
// If there is more text than this we will have a collision
|
|
||||||
if (g_ActiveConfig.bShowFPS)
|
|
||||||
{
|
|
||||||
final_yellow = final_cyan = "\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// The latest changed setting in yellow
|
|
||||||
for (int i = 0; i != lines_count; ++i)
|
|
||||||
{
|
|
||||||
if (OSDChoice == -i - 1)
|
|
||||||
final_yellow += lines[i];
|
|
||||||
final_yellow += '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
// The other settings in cyan
|
|
||||||
for (int i = 0; i != lines_count; ++i)
|
|
||||||
{
|
|
||||||
if (OSDChoice != -i - 1)
|
|
||||||
final_cyan += lines[i];
|
|
||||||
final_cyan += '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render a shadow
|
|
||||||
g_renderer->RenderText(final_cyan.c_str(), 21, 21, 0xDD000000);
|
|
||||||
g_renderer->RenderText(final_yellow.c_str(), 21, 21, 0xDD000000);
|
|
||||||
//and then the text
|
|
||||||
g_renderer->RenderText(final_cyan.c_str(), 20, 20, 0xFF00FFFF);
|
|
||||||
g_renderer->RenderText(final_yellow.c_str(), 20, 20, 0xFFFFFF00);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((u32)OSDTime <= Common::Timer::GetTimeMs())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char* res_text = "";
|
||||||
|
switch (g_ActiveConfig.iEFBScale)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
res_text = "Auto (fractional)";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
res_text = "Auto (integral)";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
res_text = "Native";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
res_text = "1.5x";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
res_text = "2x";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
res_text = "2.5x";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
res_text = "3x";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
res_text = "4x";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* ar_text = "";
|
||||||
|
switch(g_ActiveConfig.iAspectRatio)
|
||||||
|
{
|
||||||
|
case ASPECT_AUTO:
|
||||||
|
ar_text = "Auto";
|
||||||
|
break;
|
||||||
|
case ASPECT_FORCE_16_9:
|
||||||
|
ar_text = "16:9";
|
||||||
|
break;
|
||||||
|
case ASPECT_FORCE_4_3:
|
||||||
|
ar_text = "4:3";
|
||||||
|
break;
|
||||||
|
case ASPECT_STRETCH:
|
||||||
|
ar_text = "Stretch";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ?
|
||||||
|
(g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled";
|
||||||
|
|
||||||
|
// The rows
|
||||||
|
const std::string lines[] =
|
||||||
|
{
|
||||||
|
std::string("3: Internal Resolution: ") + res_text,
|
||||||
|
std::string("4: Aspect Ratio: ") + ar_text + (g_ActiveConfig.bCrop ? " (crop)" : ""),
|
||||||
|
std::string("5: Copy EFB: ") + efbcopy_text,
|
||||||
|
std::string("6: Fog: ") + (g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled"),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { lines_count = sizeof(lines)/sizeof(*lines) };
|
||||||
|
|
||||||
|
std::string final_yellow, final_cyan;
|
||||||
|
|
||||||
|
// If there is more text than this we will have a collision
|
||||||
|
if (g_ActiveConfig.bShowFPS)
|
||||||
|
{
|
||||||
|
final_yellow = final_cyan = "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// The latest changed setting in yellow
|
||||||
|
for (int i = 0; i != lines_count; ++i)
|
||||||
|
{
|
||||||
|
if (OSDChoice == -i - 1)
|
||||||
|
final_yellow += lines[i];
|
||||||
|
final_yellow += '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
// The other settings in cyan
|
||||||
|
for (int i = 0; i != lines_count; ++i)
|
||||||
|
{
|
||||||
|
if (OSDChoice != -i - 1)
|
||||||
|
final_cyan += lines[i];
|
||||||
|
final_cyan += '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render a shadow
|
||||||
|
g_renderer->RenderText(final_cyan.c_str(), 21, 21, 0xDD000000);
|
||||||
|
g_renderer->RenderText(final_yellow.c_str(), 21, 21, 0xDD000000);
|
||||||
|
//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
|
// TODO: remove
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user