summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2018-04-14 16:48:49 +0200
committerLéo Lam <leo@innovatetechnologi.es>2018-04-14 17:14:38 +0200
commit2f22c76db18db0b6b360ebf1b406c81196ef3a9c (patch)
tree6f1a65fdd9064aabf3b3612e49e19a053b398dc2 /Source/Core
parent62269572e40b8767da6848c77ba677a9a610c3a4 (diff)
UICommon: Avoid including Xrandr.h
Xlib has really terrible headers that declare non-namespaced macros and typedefs for common words. Just wasted 10 minutes trying to figure out why a unit test failed to build before I remembered it was Xrandr.h conflicting with our enum class members again. To fix the issue, this removes the Display* parameter from the EnableScreensaver function (which was unused) so we don't have to include Xrandr.h anymore.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinNoGUI/MainNoGUI.cpp2
-rw-r--r--Source/Core/DolphinQt2/MainWindow.cpp5
-rw-r--r--Source/Core/DolphinWX/Frame.cpp3
-rw-r--r--Source/Core/UICommon/UICommon.cpp4
-rw-r--r--Source/Core/UICommon/UICommon.h6
-rw-r--r--Source/Core/UICommon/X11Utils.cpp2
-rw-r--r--Source/Core/UICommon/X11Utils.h2
7 files changed, 8 insertions, 16 deletions
diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp
index def748832f..0d7a84137e 100644
--- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp
+++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp
@@ -191,7 +191,7 @@ class PlatformX11 : public Platform
s_window_handle = (void*)win;
if (SConfig::GetInstance().bDisableScreenSaver)
- X11Utils::InhibitScreensaver(dpy, win, true);
+ X11Utils::InhibitScreensaver(win, true);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfig = new X11Utils::XRRConfiguration(dpy, win);
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp
index 6d0c452050..e5f9806af9 100644
--- a/Source/Core/DolphinQt2/MainWindow.cpp
+++ b/Source/Core/DolphinQt2/MainWindow.cpp
@@ -972,10 +972,7 @@ void MainWindow::NetPlayQuit()
void MainWindow::EnableScreenSaver(bool enable)
{
#if defined(HAVE_XRANDR) && HAVE_XRANDR
- UICommon::EnableScreenSaver(
- static_cast<Display*>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow(
- "display", windowHandle())),
- winId(), enable);
+ UICommon::EnableScreenSaver(winId(), enable);
#else
UICommon::EnableScreenSaver(enable);
#endif
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index eaebe056d4..69000530e8 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -708,8 +708,7 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
void CFrame::EnableScreenSaver(bool enable)
{
#if defined(HAVE_XRANDR) && HAVE_XRANDR
- UICommon::EnableScreenSaver(X11Utils::XDisplayFromHandle(GetHandle()),
- X11Utils::XWindowFromHandle(GetHandle()), enable);
+ UICommon::EnableScreenSaver(X11Utils::XWindowFromHandle(GetHandle()), enable);
#else
UICommon::EnableScreenSaver(enable);
#endif
diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp
index f761313add..557ddcc22b 100644
--- a/Source/Core/UICommon/UICommon.cpp
+++ b/Source/Core/UICommon/UICommon.cpp
@@ -338,7 +338,7 @@ bool TriggerSTMPowerEvent()
}
#if defined(HAVE_XRANDR) && HAVE_X11
-void EnableScreenSaver(Display* display, Window win, bool enable)
+void EnableScreenSaver(Window win, bool enable)
#else
void EnableScreenSaver(bool enable)
#endif
@@ -349,7 +349,7 @@ void EnableScreenSaver(bool enable)
#if defined(HAVE_X11) && HAVE_X11
if (SConfig::GetInstance().bDisableScreenSaver)
{
- X11Utils::InhibitScreensaver(display, win, !enable);
+ X11Utils::InhibitScreensaver(win, !enable);
}
#endif
diff --git a/Source/Core/UICommon/UICommon.h b/Source/Core/UICommon/UICommon.h
index 5cef603a83..b7169bfb15 100644
--- a/Source/Core/UICommon/UICommon.h
+++ b/Source/Core/UICommon/UICommon.h
@@ -8,17 +8,13 @@
#include "Common/CommonTypes.h"
-#if defined(HAVE_XRANDR) && HAVE_XRANDR
-#include <X11/extensions/Xrandr.h>
-#endif
-
namespace UICommon
{
void Init();
void Shutdown();
#if defined(HAVE_XRANDR) && HAVE_XRANDR
-void EnableScreenSaver(Display* display, Window win, bool enable);
+void EnableScreenSaver(unsigned long win, bool enable);
#else
void EnableScreenSaver(bool enable);
#endif
diff --git a/Source/Core/UICommon/X11Utils.cpp b/Source/Core/UICommon/X11Utils.cpp
index 84273488a5..bd89d2197c 100644
--- a/Source/Core/UICommon/X11Utils.cpp
+++ b/Source/Core/UICommon/X11Utils.cpp
@@ -43,7 +43,7 @@ bool ToggleFullscreen(Display* dpy, Window win)
return true;
}
-void InhibitScreensaver(Display* dpy, Window win, bool suspend)
+void InhibitScreensaver(Window win, bool suspend)
{
char id[11];
snprintf(id, sizeof(id), "0x%lx", win);
diff --git a/Source/Core/UICommon/X11Utils.h b/Source/Core/UICommon/X11Utils.h
index 87bb518d0c..363a7df95a 100644
--- a/Source/Core/UICommon/X11Utils.h
+++ b/Source/Core/UICommon/X11Utils.h
@@ -24,7 +24,7 @@ bool ToggleFullscreen(Display* dpy, Window win);
Window XWindowFromHandle(void* Handle);
Display* XDisplayFromHandle(void* Handle);
-void InhibitScreensaver(Display* dpy, Window win, bool suspend);
+void InhibitScreensaver(Window win, bool suspend);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
class XRRConfiguration