summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-04-21 07:30:03 +0200
committerwm4 <wm4@nowhere>2017-04-21 07:30:03 +0200
commit927afa311d4a89b022305508acbf4e7325fe3928 (patch)
tree4c6aafa3fb81e67fffdfd991f9cf96693e6f3fda /video/out/x11_common.c
parent4d1eab6e552681ef961ce48af74f6795e7077fc6 (diff)
downloadmpv-927afa311d4a89b022305508acbf4e7325fe3928.tar.bz2
mpv-927afa311d4a89b022305508acbf4e7325fe3928.tar.xz
build: make various x11 protocol extension libs mandatory
Reduces the ifdeffery, which is good and will avoid silent breakages, or weird behavior if a lib is omitted. Also reorder the x11_common.c include statements.
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r--video/out/x11_common.c68
1 files changed, 17 insertions, 51 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 6f3cc41637..26f861be06 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -22,6 +22,23 @@
#include <limits.h>
#include <unistd.h>
#include <poll.h>
+#include <string.h>
+#include <assert.h>
+
+#include <X11/Xmd.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include <X11/keysym.h>
+#include <X11/XKBlib.h>
+#include <X11/XF86keysym.h>
+
+#include <X11/extensions/scrnsaver.h>
+#include <X11/extensions/dpms.h>
+#include <X11/extensions/Xinerama.h>
+#include <X11/extensions/Xrandr.h>
+
+#include <zlib.h>
#include "config.h"
#include "misc/bstr.h"
@@ -34,10 +51,6 @@
#include "x11_common.h"
#include "mpv_talloc.h"
-#include <string.h>
-#include <unistd.h>
-#include <assert.h>
-
#include "vo.h"
#include "win_state.h"
#include "osdep/io.h"
@@ -47,34 +60,6 @@
// Specifically for mp_cancel
#include "stream/stream.h"
-#include <X11/Xmd.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/keysym.h>
-#include <X11/XKBlib.h>
-#include <X11/XF86keysym.h>
-
-#if HAVE_XSS
-#include <X11/extensions/scrnsaver.h>
-#endif
-
-#if HAVE_XEXT
-#include <X11/extensions/dpms.h>
-#endif
-
-#if HAVE_XINERAMA
-#include <X11/extensions/Xinerama.h>
-#endif
-
-#if HAVE_XRANDR
-#include <X11/extensions/Xrandr.h>
-#endif
-
-#if HAVE_ZLIB
-#include <zlib.h>
-#endif
-
#include "input/input.h"
#include "input/keycodes.h"
@@ -369,7 +354,6 @@ static int vo_wm_detect(struct vo *vo)
static void xrandr_read(struct vo_x11_state *x11)
{
-#if HAVE_XRANDR
for(int i = 0; i < x11->num_displays; i++)
talloc_free(x11->displays[i].name);
@@ -434,7 +418,6 @@ static void xrandr_read(struct vo_x11_state *x11)
}
XRRFreeScreenResources(r);
-#endif
}
static void vo_x11_update_screeninfo(struct vo *vo)
@@ -443,7 +426,6 @@ static void vo_x11_update_screeninfo(struct vo *vo)
struct vo_x11_state *x11 = vo->x11;
bool all_screens = opts->fullscreen && opts->fsscreen_id == -2;
x11->screenrc = (struct mp_rect){.x1 = x11->ws_width, .y1 = x11->ws_height};
-#if HAVE_XINERAMA
if (opts->screen_id >= -1 && XineramaIsActive(x11->display) && !all_screens)
{
int screen = opts->fullscreen ? opts->fsscreen_id : opts->screen_id;
@@ -476,7 +458,6 @@ static void vo_x11_update_screeninfo(struct vo *vo)
XFree(screens);
}
-#endif
}
// Get the monitors for the 4 edges of the rectangle spanning all screens.
@@ -484,7 +465,6 @@ static void vo_x11_get_bounding_monitors(struct vo_x11_state *x11, long b[4])
{
//top bottom left right
b[0] = b[1] = b[2] = b[3] = 0;
-#if HAVE_XINERAMA
int num_screens = 0;
XineramaScreenInfo *screens = XineramaQueryScreens(x11->display, &num_screens);
if (!screens)
@@ -501,7 +481,6 @@ static void vo_x11_get_bounding_monitors(struct vo_x11_state *x11, long b[4])
b[3] = n;
}
XFree(screens);
-#endif
}
static void *screensaver_thread(void *arg)
@@ -1337,7 +1316,6 @@ static void vo_x11_xembed_send_message(struct vo_x11_state *x11, long m[4])
XSendEvent(x11->display, x11->parent, False, NoEventMask, &ev);
}
-#if HAVE_ZLIB
static bstr decompress_gz(bstr in)
{
bstr res = {0};
@@ -1380,12 +1358,6 @@ static bstr decompress_gz(bstr in)
error:
return res;
}
-#else
-static bstr decompress_gz(bstr in)
-{
- return (bstr){0};
-}
-#endif
#define MAX_ICONS 10
@@ -1978,9 +1950,6 @@ static void xscreensaver_heartbeat(struct vo_x11_state *x11)
static int xss_suspend(Display *mDisplay, Bool suspend)
{
-#if !HAVE_XSS
- return 0;
-#else
int event, error, major, minor;
if (XScreenSaverQueryExtension(mDisplay, &event, &error) != True ||
XScreenSaverQueryVersion(mDisplay, &major, &minor) != True)
@@ -1989,7 +1958,6 @@ static int xss_suspend(Display *mDisplay, Bool suspend)
return 0;
XScreenSaverSuspend(mDisplay, suspend);
return 1;
-#endif
}
static void set_screensaver(struct vo_x11_state *x11, bool enabled)
@@ -2001,7 +1969,6 @@ static void set_screensaver(struct vo_x11_state *x11, bool enabled)
x11->screensaver_enabled = enabled;
if (xss_suspend(mDisplay, !enabled))
return;
-#if HAVE_XEXT
int nothing;
if (DPMSQueryExtension(mDisplay, &nothing, &nothing)) {
BOOL onoff = 0;
@@ -2022,7 +1989,6 @@ static void set_screensaver(struct vo_x11_state *x11, bool enabled)
MP_WARN(x11, "DPMS state could not be set.\n");
}
}
-#endif
}
static void vo_x11_selectinput_witherr(struct vo *vo,