On linux check to see if the xrandr extension is present and don't use it if not.
This fixes issue 2920. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5867 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
91dafccd27
commit
379706b25a
|
@ -17,9 +17,6 @@
|
||||||
|
|
||||||
#include "X11Utils.h"
|
#include "X11Utils.h"
|
||||||
|
|
||||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace X11Utils
|
namespace X11Utils
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -41,7 +38,7 @@ void SendClientEvent(const char *message,
|
||||||
|
|
||||||
// Send the event
|
// Send the event
|
||||||
if (!XSendEvent(dpy, win, False, False, &event))
|
if (!XSendEvent(dpy, win, False, False, &event))
|
||||||
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.\n", message);
|
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendKeyEvent(int key)
|
void SendKeyEvent(int key)
|
||||||
|
@ -58,7 +55,7 @@ void SendKeyEvent(int key)
|
||||||
|
|
||||||
// Send the event
|
// Send the event
|
||||||
if (!XSendEvent(dpy, win, False, False, &event))
|
if (!XSendEvent(dpy, win, False, False, &event))
|
||||||
ERROR_LOG(VIDEO, "Failed to send key press event to the emulator window.\n");
|
ERROR_LOG(VIDEO, "Failed to send key press event to the emulator window.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EWMH_Fullscreen(int action)
|
void EWMH_Fullscreen(int action)
|
||||||
|
@ -81,7 +78,7 @@ void EWMH_Fullscreen(int action)
|
||||||
// Send the event
|
// Send the event
|
||||||
if (!XSendEvent(dpy, DefaultRootWindow(dpy), False,
|
if (!XSendEvent(dpy, DefaultRootWindow(dpy), False,
|
||||||
SubstructureRedirectMask | SubstructureNotifyMask, &event))
|
SubstructureRedirectMask | SubstructureNotifyMask, &event))
|
||||||
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.\n");
|
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
|
@ -101,7 +98,21 @@ XRRConfiguration::XRRConfiguration(Display *_dpy, Window _win)
|
||||||
: dpy(_dpy)
|
: dpy(_dpy)
|
||||||
, win(_win)
|
, win(_win)
|
||||||
, deskSize(-1), fullSize(-1)
|
, deskSize(-1), fullSize(-1)
|
||||||
|
, bValid(true)
|
||||||
{
|
{
|
||||||
|
XRRScreenSize *sizes;
|
||||||
|
int numSizes;
|
||||||
|
|
||||||
|
// XRRSizes is safe to call even if the RANDR extension is not present and numSizes
|
||||||
|
// will be 0 in that case (according to the documentation)
|
||||||
|
sizes = XRRSizes(dpy, DefaultScreen(dpy), &numSizes);
|
||||||
|
if (!numSizes)
|
||||||
|
{
|
||||||
|
NOTICE_LOG(VIDEO, "XRRExtension not supported.");
|
||||||
|
bValid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int vidModeMajorVersion, vidModeMinorVersion;
|
int vidModeMajorVersion, vidModeMinorVersion;
|
||||||
XRRQueryVersion(dpy, &vidModeMajorVersion, &vidModeMinorVersion);
|
XRRQueryVersion(dpy, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||||
NOTICE_LOG(VIDEO, "XRRExtension-Version %d.%d", vidModeMajorVersion, vidModeMinorVersion);
|
NOTICE_LOG(VIDEO, "XRRExtension-Version %d.%d", vidModeMajorVersion, vidModeMinorVersion);
|
||||||
|
@ -110,13 +121,19 @@ XRRConfiguration::XRRConfiguration(Display *_dpy, Window _win)
|
||||||
|
|
||||||
XRRConfiguration::~XRRConfiguration()
|
XRRConfiguration::~XRRConfiguration()
|
||||||
{
|
{
|
||||||
ToggleDisplayMode(False);
|
if (bValid)
|
||||||
XRRFreeScreenConfigInfo(screenConfig);
|
{
|
||||||
|
ToggleDisplayMode(False);
|
||||||
|
XRRFreeScreenConfigInfo(screenConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XRRConfiguration::Update()
|
void XRRConfiguration::Update()
|
||||||
{
|
{
|
||||||
|
if (!bValid)
|
||||||
|
return;
|
||||||
|
|
||||||
// Get the resolution setings for fullscreen mode
|
// Get the resolution setings for fullscreen mode
|
||||||
int fullWidth, fullHeight;
|
int fullWidth, fullHeight;
|
||||||
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(),
|
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(),
|
||||||
|
@ -145,12 +162,15 @@ void XRRConfiguration::Update()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ERROR_LOG(VIDEO, "Failed to obtain fullscreen size.\n"
|
ERROR_LOG(VIDEO, "Failed to obtain fullscreen size.\n"
|
||||||
"Using current desktop resolution for fullscreen.\n");
|
"Using current desktop resolution for fullscreen.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XRRConfiguration::ToggleDisplayMode(bool bFullscreen)
|
void XRRConfiguration::ToggleDisplayMode(bool bFullscreen)
|
||||||
{
|
{
|
||||||
|
if (!bValid)
|
||||||
|
return;
|
||||||
|
|
||||||
if (bFullscreen)
|
if (bFullscreen)
|
||||||
XRRSetScreenConfig(dpy, screenConfig, win,
|
XRRSetScreenConfig(dpy, screenConfig, win,
|
||||||
fullSize, screenRotation, CurrentTime);
|
fullSize, screenRotation, CurrentTime);
|
||||||
|
@ -162,6 +182,9 @@ void XRRConfiguration::ToggleDisplayMode(bool bFullscreen)
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenResolution)
|
void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenResolution)
|
||||||
{
|
{
|
||||||
|
if (!bValid)
|
||||||
|
return;
|
||||||
|
|
||||||
int screen;
|
int screen;
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(dpy);
|
||||||
//Get all full screen resos for the config dialog
|
//Get all full screen resos for the config dialog
|
||||||
|
|
|
@ -71,7 +71,7 @@ class XRRConfiguration
|
||||||
XRRScreenConfiguration *screenConfig;
|
XRRScreenConfiguration *screenConfig;
|
||||||
Rotation screenRotation;
|
Rotation screenRotation;
|
||||||
int deskSize, fullSize;
|
int deskSize, fullSize;
|
||||||
|
bool bValid;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue