x11: Require xrandr 1.5 at build time

While leaving the runtime checks in place, requiring xrandr 1.5 at build
time allows us to remove some seemingly unnecessary conditional
inclusion of functionality.
This commit is contained in:
Jonas Ådahl 2018-07-12 17:03:48 +02:00
parent 2f4a68c8c3
commit ecec99eedb
5 changed files with 2 additions and 37 deletions

View File

@ -100,6 +100,7 @@ MUTTER_PC_MODULES="
xkbcommon >= 0.4.3
xkbcommon-x11
xrender
xrandr >= 1.5.0
x11-xcb
xcb-randr
xcb-res
@ -381,21 +382,7 @@ fi
AC_DEFINE_UNQUOTED([XKB_BASE], ["`$PKG_CONFIG --variable xkb_base xkeyboard-config`"],
[XKB base dir])
RANDR_LIBS=
found_randr=no
AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
[AC_CHECK_HEADER(X11/extensions/Xrandr.h,
RANDR_LIBS=-lXrandr found_randr=yes,,
[#include <X11/Xlib.h>])],
, -lXext $ALL_X_LIBS)
if test "x$found_randr" = "xyes"; then
AC_DEFINE(HAVE_RANDR, , [Have the Xrandr extension library])
PKG_CHECK_EXISTS([xrandr >= 1.5.0],
AC_DEFINE([HAVE_XRANDR15],[1],[Define if you have support for XRandR 1.5 or greater]))
fi
MUTTER_LIBS="$MUTTER_LIBS $RANDR_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm"
MUTTER_LIBS="$MUTTER_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm"
found_sm=no
case "$MUTTER_LIBS" in

View File

@ -70,9 +70,7 @@ struct _MetaMonitorManagerXrandr
xcb_timestamp_t last_xrandr_set_timestamp;
#ifdef HAVE_XRANDR15
GHashTable *tiled_monitor_atoms;
#endif /* HAVE_XRANDR15 */
float *supported_scales;
int n_supported_scales;
@ -85,14 +83,12 @@ struct _MetaMonitorManagerXrandrClass
G_DEFINE_TYPE (MetaMonitorManagerXrandr, meta_monitor_manager_xrandr, META_TYPE_MONITOR_MANAGER);
#ifdef HAVE_XRANDR15
typedef struct _MetaMonitorXrandrData
{
Atom xrandr_name;
} MetaMonitorXrandrData;
GQuark quark_meta_monitor_xrandr_data;
#endif /* HAVE_RANDR15 */
Display *
meta_monitor_manager_xrandr_get_xdisplay (MetaMonitorManagerXrandr *manager_xrandr)
@ -669,7 +665,6 @@ meta_monitor_manager_xrandr_set_crtc_gamma (MetaMonitorManager *manager,
XRRFreeGamma (gamma);
}
#ifdef HAVE_XRANDR15
static MetaMonitorXrandrData *
meta_monitor_xrandr_data_from_monitor (MetaMonitor *monitor)
{
@ -830,7 +825,6 @@ meta_monitor_manager_xrandr_init_monitors (MetaMonitorManagerXrandr *manager_xra
}
XRRFreeMonitors (m);
}
#endif
static gboolean
meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager,
@ -999,7 +993,6 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
manager_xrandr->has_randr15 = FALSE;
XRRQueryVersion (manager_xrandr->xdisplay, &major_version,
&minor_version);
#ifdef HAVE_XRANDR15
if (major_version > 1 ||
(major_version == 1 &&
minor_version >= 5))
@ -1008,7 +1001,6 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
manager_xrandr->tiled_monitor_atoms = g_hash_table_new (NULL, NULL);
}
meta_monitor_manager_xrandr_init_monitors (manager_xrandr);
#endif
}
G_OBJECT_CLASS (meta_monitor_manager_xrandr_parent_class)->constructed (object);
@ -1047,10 +1039,8 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
manager_class->change_backlight = meta_monitor_manager_xrandr_change_backlight;
manager_class->get_crtc_gamma = meta_monitor_manager_xrandr_get_crtc_gamma;
manager_class->set_crtc_gamma = meta_monitor_manager_xrandr_set_crtc_gamma;
#ifdef HAVE_XRANDR15
manager_class->tiled_monitor_added = meta_monitor_manager_xrandr_tiled_monitor_added;
manager_class->tiled_monitor_removed = meta_monitor_manager_xrandr_tiled_monitor_removed;
#endif
manager_class->is_transform_handled = meta_monitor_manager_xrandr_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_xrandr_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_xrandr_calculate_supported_scales;

View File

@ -42,10 +42,6 @@
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xfixes.h>
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
#include "backends/meta-cursor-sprite-xcursor.h"
#include "backends/meta-cursor-tracker-private.h"
#include "backends/meta-idle-monitor-dbus.h"

View File

@ -118,11 +118,6 @@ static void prefs_changed_callback (MetaPreference pref,
static void
meta_print_compilation_info (void)
{
#ifdef HAVE_RANDR
meta_verbose ("Compiled with randr extension\n");
#else
meta_verbose ("Compiled without randr extension\n");
#endif
#ifdef HAVE_STARTUP_NOTIFICATION
meta_verbose ("Compiled with startup notification\n");
#else

View File

@ -45,10 +45,7 @@
#include <X11/extensions/Xdamage.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xinerama.h>
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
#include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"