Simplify macro guards for HAVE_XRANDR

This commit is contained in:
Norbert Lange 2021-02-22 14:32:53 +01:00
parent 29eaf09be4
commit d4b293e969
7 changed files with 12 additions and 14 deletions

View File

@ -440,8 +440,6 @@ if(ENABLE_X11)
check_lib(XRANDR xrandr Xrandr) check_lib(XRANDR xrandr Xrandr)
if(XRANDR_FOUND) if(XRANDR_FOUND)
add_definitions(-DHAVE_XRANDR=1) add_definitions(-DHAVE_XRANDR=1)
else()
add_definitions(-DHAVE_XRANDR=0)
endif() endif()
pkg_check_modules(X11_INPUT REQUIRED xi>=1.5.0) pkg_check_modules(X11_INPUT REQUIRED xi>=1.5.0)
message(STATUS "X11 support enabled") message(STATUS "X11 support enabled")

View File

@ -48,7 +48,7 @@ private:
Display* m_display = nullptr; Display* m_display = nullptr;
Window m_window = {}; Window m_window = {};
Cursor m_blank_cursor = None; Cursor m_blank_cursor = None;
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
X11Utils::XRRConfiguration* m_xrr_config = nullptr; X11Utils::XRRConfiguration* m_xrr_config = nullptr;
#endif #endif
int m_window_x = Config::Get(Config::MAIN_RENDER_WINDOW_XPOS); int m_window_x = Config::Get(Config::MAIN_RENDER_WINDOW_XPOS);
@ -59,7 +59,7 @@ private:
PlatformX11::~PlatformX11() PlatformX11::~PlatformX11()
{ {
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
delete m_xrr_config; delete m_xrr_config;
#endif #endif
@ -106,7 +106,7 @@ bool PlatformX11::Init()
if (Config::Get(Config::MAIN_DISABLE_SCREENSAVER)) if (Config::Get(Config::MAIN_DISABLE_SCREENSAVER))
X11Utils::InhibitScreensaver(m_window, true); X11Utils::InhibitScreensaver(m_window, true);
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
m_xrr_config = new X11Utils::XRRConfiguration(m_display, m_window); m_xrr_config = new X11Utils::XRRConfiguration(m_display, m_window);
#endif #endif
@ -126,7 +126,7 @@ bool PlatformX11::Init()
if (Config::Get(Config::MAIN_FULLSCREEN)) if (Config::Get(Config::MAIN_FULLSCREEN))
{ {
m_window_fullscreen = X11Utils::ToggleFullscreen(m_display, m_window); m_window_fullscreen = X11Utils::ToggleFullscreen(m_display, m_window);
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
m_xrr_config->ToggleDisplayMode(True); m_xrr_config->ToggleDisplayMode(True);
#endif #endif
ProcessEvents(); ProcessEvents();
@ -210,7 +210,7 @@ void PlatformX11::ProcessEvents()
{ {
m_window_fullscreen = !m_window_fullscreen; m_window_fullscreen = !m_window_fullscreen;
X11Utils::ToggleFullscreen(m_display, m_window); X11Utils::ToggleFullscreen(m_display, m_window);
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
m_xrr_config->ToggleDisplayMode(m_window_fullscreen); m_xrr_config->ToggleDisplayMode(m_window_fullscreen);
#endif #endif
UpdateWindowPosition(); UpdateWindowPosition();

View File

@ -119,7 +119,7 @@
#include "VideoCommon/NetPlayChatUI.h" #include "VideoCommon/NetPlayChatUI.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
#include "UICommon/X11Utils.h" #include "UICommon/X11Utils.h"
// This #define within X11/X.h conflicts with our WiimoteSource enum. // This #define within X11/X.h conflicts with our WiimoteSource enum.
#undef None #undef None
@ -1172,7 +1172,7 @@ void MainWindow::ShowGraphicsWindow()
{ {
if (!m_graphics_window) if (!m_graphics_window)
{ {
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
if (GetWindowSystemType() == WindowSystemType::X11) if (GetWindowSystemType() == WindowSystemType::X11)
{ {
m_xrr_config = std::make_unique<X11Utils::XRRConfiguration>( m_xrr_config = std::make_unique<X11Utils::XRRConfiguration>(

View File

@ -191,7 +191,7 @@ private:
void dropEvent(QDropEvent* event) override; void dropEvent(QDropEvent* event) override;
QSize sizeHint() const override; QSize sizeHint() const override;
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
std::unique_ptr<X11Utils::XRRConfiguration> m_xrr_config; std::unique_ptr<X11Utils::XRRConfiguration> m_xrr_config;
#endif #endif

View File

@ -11,7 +11,7 @@
#include <Windows.h> #include <Windows.h>
#endif #endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
#include "UICommon/X11Utils.h" #include "UICommon/X11Utils.h"
#endif #endif

View File

@ -64,7 +64,7 @@ void InhibitScreensaver(Window win, bool suspend)
} }
} }
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
XRRConfiguration::XRRConfiguration(Display* _dpy, Window _win) XRRConfiguration::XRRConfiguration(Display* _dpy, Window _win)
: dpy(_dpy), win(_win), screenResources(nullptr), outputInfo(nullptr), crtcInfo(nullptr), : dpy(_dpy), win(_win), screenResources(nullptr), outputInfo(nullptr), crtcInfo(nullptr),
fullMode(0), fs_fb_width(0), fs_fb_height(0), fs_fb_width_mm(0), fs_fb_height_mm(0), fullMode(0), fs_fb_width(0), fs_fb_height(0), fs_fb_width_mm(0), fs_fb_height_mm(0),

View File

@ -7,7 +7,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
#include <X11/extensions/Xrandr.h> #include <X11/extensions/Xrandr.h>
#endif #endif
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -26,7 +26,7 @@ Display* XDisplayFromHandle(void* Handle);
void InhibitScreensaver(Window win, bool suspend); void InhibitScreensaver(Window win, bool suspend);
#if defined(HAVE_XRANDR) && HAVE_XRANDR #ifdef HAVE_XRANDR
class XRRConfiguration class XRRConfiguration
{ {
public: public: