Require the XSync and XShape extensions at build-time

It's been long enough. We can mandate support for these, at least
at build-time. The code doesn't actually compile without either
of these, so just consider that unsupported.
This commit is contained in:
Jasper St. Pierre 2014-04-22 12:52:20 -04:00
parent d8dfe4e4ad
commit 20a0eb9809
12 changed files with 2 additions and 169 deletions

View File

@ -74,7 +74,7 @@ MUTTER_PC_MODULES="
pango >= 1.2.0
cairo >= 1.10.0
gsettings-desktop-schemas >= 3.7.3
xcomposite >= 0.2 xfixes xdamage xi >= 1.6.0
xcomposite >= 0.2 xfixes xext xdamage xi >= 1.6.0
$CLUTTER_PACKAGE >= 1.17.5
cogl-1.0 >= 1.17.1
upower-glib >= 0.99.0
@ -249,28 +249,6 @@ if test x$have_xinerama = xno; then
AC_MSG_ERROR([Xinerama extension was not found])
fi
SHAPE_LIBS=
found_shape=no
AC_CHECK_LIB(Xext, XShapeQueryExtension,
[AC_CHECK_HEADER(X11/extensions/shape.h,
SHAPE_LIBS=-lXext found_shape=yes)],
, $ALL_X_LIBS)
if test x$enable_shape = xno; then
found_shape=no
fi
if test x$enable_shape = xyes; then
if test "$found_shape" = "no"; then
AC_MSG_ERROR([--enable-shape forced and Shape not found])
exit 1
fi
fi
if test "x$found_shape" = "xyes"; then
AC_DEFINE(HAVE_SHAPE, , [Have the shape extension library])
fi
found_xkb=no
AC_CHECK_LIB(X11, XkbQueryExtension,
[AC_CHECK_HEADER(X11/XKBlib.h,
@ -294,31 +272,7 @@ if test "x$found_randr" = "xyes"; then
AC_DEFINE(HAVE_RANDR, , [Have the Xrandr extension library])
fi
XSYNC_LIBS=
found_xsync=no
AC_CHECK_LIB(Xext, XSyncQueryExtension,
[AC_CHECK_HEADER(X11/extensions/sync.h,
found_xsync=yes,,
[#include <X11/Xlib.h>])],
, $ALL_X_LIBS)
if test x$enable_xsync = xno; then
found_xsync=no
fi
if test x$enable_xsync = xyes; then
if test "$found_xsync" = "no"; then
AC_MSG_ERROR([--enable-xsync forced and XSync not found])
exit 1
fi
fi
if test "x$found_xsync" = "xyes"; then
XSYNC_LIBS=-lXext
AC_DEFINE(HAVE_XSYNC, , [Have the Xsync extension library])
fi
MUTTER_LIBS="$MUTTER_LIBS $XSYNC_LIBS $RANDR_LIBS $SHAPE_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm"
MUTTER_LIBS="$MUTTER_LIBS $RANDR_LIBS $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm"
found_sm=no
case "$MUTTER_LIBS" in
@ -475,8 +429,6 @@ mutter-$VERSION
libcanberra: ${have_libcanberra}
Introspection: ${found_introspection}
Session management: ${found_sm}
Shape extension: ${found_shape}
Xsync: ${found_xsync}
"

View File

@ -43,9 +43,7 @@
#include <libsn/sn.h>
#endif
#ifdef HAVE_XSYNC
#include <X11/extensions/sync.h>
#endif
typedef struct _MetaStack MetaStack;
typedef struct _MetaUISlave MetaUISlave;
@ -280,26 +278,14 @@ struct _MetaDisplay
#ifdef HAVE_STARTUP_NOTIFICATION
SnDisplay *sn_display;
#endif
#ifdef HAVE_XSYNC
int xsync_event_base;
int xsync_error_base;
#endif
#ifdef HAVE_SHAPE
int shape_event_base;
int shape_error_base;
#endif
#ifdef HAVE_XSYNC
unsigned int have_xsync : 1;
#define META_DISPLAY_HAS_XSYNC(display) ((display)->have_xsync)
#else
#define META_DISPLAY_HAS_XSYNC(display) FALSE
#endif
#ifdef HAVE_SHAPE
unsigned int have_shape : 1;
#define META_DISPLAY_HAS_SHAPE(display) ((display)->have_shape)
#else
#define META_DISPLAY_HAS_SHAPE(display) FALSE
#endif
unsigned int have_composite : 1;
unsigned int have_damage : 1;
#define META_DISPLAY_HAS_COMPOSITE(display) ((display)->have_composite)
@ -362,7 +348,6 @@ void meta_display_register_wayland_window (MetaDisplay *display,
void meta_display_unregister_wayland_window (MetaDisplay *display,
MetaWindow *window);
#ifdef HAVE_XSYNC
MetaWindow* meta_display_lookup_sync_alarm (MetaDisplay *display,
XSyncAlarm alarm);
void meta_display_register_sync_alarm (MetaDisplay *display,
@ -370,7 +355,6 @@ void meta_display_register_sync_alarm (MetaDisplay *display,
MetaWindow *window);
void meta_display_unregister_sync_alarm (MetaDisplay *display,
XSyncAlarm alarm);
#endif /* HAVE_XSYNC */
void meta_display_notify_window_created (MetaDisplay *display,
MetaWindow *window);

View File

@ -54,9 +54,7 @@
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
#endif
#include <X11/Xcursor/Xcursor.h>
#include <X11/extensions/Xcomposite.h>
#include <X11/extensions/Xdamage.h>
@ -561,7 +559,6 @@ meta_display_open (void)
the_display->grab_edge_resistance_data = NULL;
#ifdef HAVE_XSYNC
{
int major, minor;
@ -594,12 +591,7 @@ meta_display_open (void)
the_display->xsync_error_base,
the_display->xsync_event_base);
}
#else /* HAVE_XSYNC */
meta_verbose ("Not compiled with Xsync support\n");
#endif /* !HAVE_XSYNC */
#ifdef HAVE_SHAPE
{
the_display->have_shape = FALSE;
@ -620,9 +612,6 @@ meta_display_open (void)
the_display->shape_error_base,
the_display->shape_event_base);
}
#else /* HAVE_SHAPE */
meta_verbose ("Not compiled with Shape support\n");
#endif /* !HAVE_SHAPE */
{
the_display->have_composite = FALSE;
@ -1630,7 +1619,6 @@ meta_display_unregister_wayland_window (MetaDisplay *display,
g_hash_table_remove (display->wayland_windows, window);
}
#ifdef HAVE_XSYNC
/* We store sync alarms in the window ID hash table, because they are
* just more types of XIDs in the same global space, but we have
* typesafe functions to register/unregister for readability.
@ -1661,7 +1649,6 @@ meta_display_unregister_sync_alarm (MetaDisplay *display,
g_hash_table_remove (display->xids, &alarm);
}
#endif /* HAVE_XSYNC */
void
meta_display_notify_window_created (MetaDisplay *display,
@ -1904,9 +1891,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_latest_motion_y = root_y;
display->grab_last_moveresize_time.tv_sec = 0;
display->grab_last_moveresize_time.tv_usec = 0;
#ifdef HAVE_XSYNC
display->grab_last_user_action_was_snap = FALSE;
#endif
display->grab_frame_action = frame_action;
display->grab_resize_unmaximize = 0;
display->grab_timestamp = timestamp;
@ -1923,13 +1908,11 @@ meta_display_begin_grab_op (MetaDisplay *display,
&display->grab_initial_window_pos);
display->grab_anchor_window_pos = display->grab_initial_window_pos;
#ifdef HAVE_XSYNC
if ( meta_grab_op_is_resizing (display->grab_op) &&
display->grab_window->sync_request_counter != None)
{
meta_window_create_sync_request_alarm (display->grab_window);
}
#endif
}
meta_topic (META_DEBUG_WINDOW_OPS,
@ -3278,13 +3261,11 @@ meta_display_get_damage_event_base (MetaDisplay *display)
return display->damage_event_base;
}
#ifdef HAVE_SHAPE
int
meta_display_get_shape_event_base (MetaDisplay *display)
{
return display->shape_event_base;
}
#endif
/**
* meta_display_clear_mouse_mode:

View File

@ -25,9 +25,7 @@
#include <X11/Xatom.h>
#include <X11/extensions/Xdamage.h>
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
#endif
#include <meta/errors.h>
#include "display-private.h"
@ -214,14 +212,12 @@ event_get_modified_window (MetaDisplay *display,
return None;
default:
#ifdef HAVE_SHAPE
if (META_DISPLAY_HAS_SHAPE (display) &&
event->type == (display->shape_event_base + ShapeNotify))
{
XShapeEvent *sev = (XShapeEvent*) event;
return sev->window;
}
#endif
return None;
}
@ -351,7 +347,6 @@ stack_mode_to_string (int mode)
return "Unknown";
}
#ifdef HAVE_XSYNC
G_GNUC_UNUSED static gint64
sync_value_to_64 (const XSyncValue *value)
{
@ -378,7 +373,6 @@ alarm_state_to_string (XSyncAlarmState state)
return "(unknown)";
}
}
#endif /* HAVE_XSYNC */
G_GNUC_UNUSED static void
meta_spew_xi2_event (MetaDisplay *display,
@ -612,7 +606,6 @@ meta_spew_core_event (MetaDisplay *display,
name = "MappingNotify";
break;
default:
#ifdef HAVE_XSYNC
if (META_DISPLAY_HAS_XSYNC (display) &&
event->type == (display->xsync_event_base + XSyncAlarmNotify))
{
@ -631,8 +624,6 @@ meta_spew_core_event (MetaDisplay *display,
alarm_state_to_string (aevent->state));
}
else
#endif /* HAVE_XSYNC */
#ifdef HAVE_SHAPE
if (META_DISPLAY_HAS_SHAPE (display) &&
event->type == (display->shape_event_base + ShapeNotify))
{
@ -652,7 +643,6 @@ meta_spew_core_event (MetaDisplay *display,
sev->shaped);
}
else
#endif /* HAVE_SHAPE */
{
name = "(Unknown event)";
extra = g_strdup_printf ("type: %d", event->xany.type);
@ -1248,7 +1238,6 @@ handle_other_xevent (MetaDisplay *display,
window = NULL;
}
#ifdef HAVE_XSYNC
if (META_DISPLAY_HAS_XSYNC (display) &&
event->type == (display->xsync_event_base + XSyncAlarmNotify))
{
@ -1266,9 +1255,7 @@ handle_other_xevent (MetaDisplay *display,
goto out;
}
#endif /* HAVE_XSYNC */
#ifdef HAVE_SHAPE
if (META_DISPLAY_HAS_SHAPE (display) &&
event->type == (display->shape_event_base + ShapeNotify))
{
@ -1293,7 +1280,6 @@ handle_other_xevent (MetaDisplay *display,
goto out;
}
#endif /* HAVE_SHAPE */
switch (event->type)
{

View File

@ -125,16 +125,6 @@ log_handler (const gchar *log_domain,
static void
meta_print_compilation_info (void)
{
#ifdef HAVE_SHAPE
meta_verbose ("Compiled with shape extension\n");
#else
meta_verbose ("Compiled without shape extension\n");
#endif
#ifdef HAVE_XSYNC
meta_verbose ("Compiled with sync extension\n");
#else
meta_verbose ("Compiled without sync extension\n");
#endif
#ifdef HAVE_RANDR
meta_verbose ("Compiled with randr extension\n");
#else

View File

@ -380,7 +380,6 @@ struct _MetaWindow
/* Note: can be NULL */
GSList *struts;
#ifdef HAVE_XSYNC
/* XSync update counter */
XSyncCounter sync_request_counter;
gint64 sync_request_serial;
@ -388,7 +387,6 @@ struct _MetaWindow
guint sync_request_timeout_id;
/* alarm monitoring client's _NET_WM_SYNC_REQUEST_COUNTER */
XSyncAlarm sync_request_alarm;
#endif
/* Number of UnmapNotify that are caused by us, if
* we get UnmapNotify with none pending then the client
@ -638,10 +636,8 @@ void meta_window_show_menu (MetaWindow *window,
int button,
guint32 timestamp);
#ifdef HAVE_XSYNC
void meta_window_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value);
#endif /* HAVE_XSYNC */
gboolean meta_window_handle_mouse_grab_op_event (MetaWindow *window,
const ClutterEvent *event);

View File

@ -50,10 +50,6 @@
#include <string.h>
#include <math.h>
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
#endif
#include "meta/compositor-mutter.h"
#include "x11/window-x11.h"
@ -797,12 +793,10 @@ _meta_window_shared_new (MetaDisplay *display,
window->display = display;
window->workspace = NULL;
#ifdef HAVE_XSYNC
window->sync_request_counter = None;
window->sync_request_serial = 0;
window->sync_request_timeout_id = 0;
window->sync_request_alarm = None;
#endif
window->screen = screen;
@ -3936,7 +3930,6 @@ adjust_for_gravity (MetaWindow *window,
void
meta_window_create_sync_request_alarm (MetaWindow *window)
{
#ifdef HAVE_XSYNC
XSyncAlarmAttributes values;
XSyncValue init;
@ -4002,13 +3995,11 @@ meta_window_create_sync_request_alarm (MetaWindow *window)
window->sync_request_alarm = None;
window->sync_request_counter = None;
}
#endif
}
void
meta_window_destroy_sync_request_alarm (MetaWindow *window)
{
#ifdef HAVE_XSYNC
if (window->sync_request_alarm != None)
{
/* Has to be unregistered _before_ clearing the structure field */
@ -4017,7 +4008,6 @@ meta_window_destroy_sync_request_alarm (MetaWindow *window)
window->sync_request_alarm);
window->sync_request_alarm = None;
}
#endif /* HAVE_XSYNC */
}
/**
@ -4035,14 +4025,12 @@ meta_window_destroy_sync_request_alarm (MetaWindow *window)
gboolean
meta_window_updates_are_frozen (MetaWindow *window)
{
#ifdef HAVE_XSYNC
if (window->extended_sync_request_counter &&
window->sync_request_serial % 2 == 1)
return TRUE;
if (window->sync_request_serial < window->sync_request_wait_serial)
return TRUE;
#endif
return FALSE;
}
@ -6822,13 +6810,11 @@ check_moveresize_frequency (MetaWindow *window,
g_get_current_time (&current_time);
#ifdef HAVE_XSYNC
/* If we are throttling via _NET_WM_SYNC_REQUEST, we don't need
* an artificial timeout-based throttled */
if (!window->disable_sync &&
window->sync_request_alarm != None)
return TRUE;
#endif /* HAVE_XSYNC */
elapsed = time_diff (&current_time, &window->display->grab_last_moveresize_time);
@ -7333,14 +7319,12 @@ update_resize (MetaWindow *window,
break;
}
#ifdef HAVE_XSYNC
/* If we're waiting for a request for _NET_WM_SYNC_REQUEST, we'll
* resize the window when the window responds, or when we time
* the response out.
*/
if (window->sync_request_timeout_id != 0)
return;
#endif
if (!check_moveresize_frequency (window, &remaining) && !force)
{
@ -7465,7 +7449,6 @@ meta_window_update_resize (MetaWindow *window,
update_resize (window, snap, x, y, force);
}
#ifdef HAVE_XSYNC
void
meta_window_update_sync_request_counter (MetaWindow *window,
gint64 new_counter_value)
@ -7516,7 +7499,6 @@ meta_window_update_sync_request_counter (MetaWindow *window,
meta_compositor_queue_frame_drawn (window->display->compositor, window,
no_delay_frame);
}
#endif /* HAVE_XSYNC */
static void
end_grab_op (MetaWindow *window,

View File

@ -35,10 +35,6 @@
#include <cairo-xlib.h>
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
#endif
#define DEFAULT_INNER_BUTTON_BORDER 3
static void meta_frames_destroy (GtkWidget *object);

View File

@ -900,7 +900,6 @@ reload_update_counter (MetaWindow *window,
meta_window_destroy_sync_request_alarm (window);
window->sync_request_counter = None;
#ifdef HAVE_XSYNC
if (value->v.xcounter_list.n_counters == 0)
{
meta_warning ("_NET_WM_SYNC_REQUEST_COUNTER is empty\n");
@ -923,7 +922,6 @@ reload_update_counter (MetaWindow *window,
if (window->extended_sync_request_counter)
meta_window_create_sync_request_alarm (window);
#endif
}
}

View File

@ -29,9 +29,7 @@
#include <X11/Xatom.h>
#include <X11/Xlibint.h> /* For display->resource_mask */
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
#endif
#include <X11/extensions/Xcomposite.h>
#include "core.h"
@ -344,10 +342,8 @@ meta_window_x11_unmanage (MetaWindow *window)
window->user_time_window = None;
}
#ifdef HAVE_SHAPE
if (META_DISPLAY_HAS_SHAPE (window->display))
XShapeSelectInput (window->display->xdisplay, window->xwindow, NoEventMask);
#endif
/* The XReparentWindow call in meta_window_destroy_frame() moves the
* window so we need to send a configure notify; see bug 399552. (We
@ -526,7 +522,6 @@ update_net_frame_extents (MetaWindow *window)
meta_error_trap_pop (window->display);
}
#ifdef HAVE_XSYNC
static gboolean
sync_request_timeout (gpointer data)
{
@ -610,7 +605,6 @@ send_sync_request (MetaWindow *window)
meta_compositor_set_updates_frozen (window->display->compositor, window,
meta_window_updates_are_frozen (window));
}
#endif
static void
meta_window_x11_move_resize_internal (MetaWindow *window,
@ -866,7 +860,6 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
meta_error_trap_push (window->display);
#ifdef HAVE_XSYNC
if (window == window->display->grab_window &&
meta_grab_op_is_resizing (window->display->grab_op) &&
!window->disable_sync &&
@ -876,7 +869,6 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
{
send_sync_request (window);
}
#endif
XConfigureWindow (window->display->xdisplay,
window->xwindow,
@ -1275,7 +1267,6 @@ meta_window_x11_update_input_region (MetaWindow *window)
return;
}
#ifdef HAVE_SHAPE
if (META_DISPLAY_HAS_SHAPE (window->display))
{
/* Translate the set of XShape rectangles that we
@ -1307,7 +1298,6 @@ meta_window_x11_update_input_region (MetaWindow *window)
XFree (rects);
}
}
#endif /* HAVE_SHAPE */
if (region != NULL)
{
@ -1349,7 +1339,6 @@ meta_window_x11_update_shape_region (MetaWindow *window)
{
cairo_region_t *region = NULL;
#ifdef HAVE_SHAPE
if (META_DISPLAY_HAS_SHAPE (window->display))
{
/* Translate the set of XShape rectangles that we
@ -1384,7 +1373,6 @@ meta_window_x11_update_shape_region (MetaWindow *window)
XFree (rects);
}
}
#endif /* HAVE_SHAPE */
if (region != NULL)
{
@ -2337,10 +2325,8 @@ meta_window_x11_new (MetaDisplay *display,
XISelectEvents (display->xdisplay, xwindow, &mask, 1);
}
#ifdef HAVE_SHAPE
if (META_DISPLAY_HAS_SHAPE (display))
XShapeSelectInput (display->xdisplay, xwindow, ShapeNotifyMask);
#endif
/* Get rid of any borders */
if (attrs.border_width != 0)

View File

@ -637,7 +637,6 @@ window_from_results (GetPropertyResults *results,
return TRUE;
}
#ifdef HAVE_XSYNC
static gboolean
counter_from_results (GetPropertyResults *results,
XSyncCounter *counter_p)
@ -670,7 +669,6 @@ counter_list_from_results (GetPropertyResults *results,
return TRUE;
}
#endif
gboolean
meta_prop_get_window (MetaDisplay *display,
@ -1278,7 +1276,6 @@ meta_prop_get_values (MetaDisplay *display,
&values[i].v.size_hints.flags))
values[i].type = META_PROP_VALUE_INVALID;
break;
#ifdef HAVE_XSYNC
case META_PROP_VALUE_SYNC_COUNTER:
if (!counter_from_results (&results,
&values[i].v.xcounter))
@ -1290,17 +1287,6 @@ meta_prop_get_values (MetaDisplay *display,
&values[i].v.xcounter_list.n_counters))
values[i].type = META_PROP_VALUE_INVALID;
break;
#else
case META_PROP_VALUE_SYNC_COUNTER:
case META_PROP_VALUE_SYNC_COUNTER_LIST:
values[i].type = META_PROP_VALUE_INVALID;
if (results.prop)
{
XFree (results.prop);
results.prop = NULL;
}
break;
#endif
}
next:

View File

@ -27,9 +27,7 @@
#include <meta/display.h>
#include <X11/Xutil.h>
#ifdef HAVE_XSYNC
#include <X11/extensions/sync.h>
#endif
/* Copied from Lesstif by way of GTK. Rudimentary docs can be
* found in some Motif reference guides online.
@ -179,14 +177,12 @@ typedef struct
gulong cardinal;
XWMHints *wm_hints;
XClassHint class_hint;
#ifdef HAVE_XSYNC
XSyncCounter xcounter;
struct
{
gulong *counters;
int n_counters;
} xcounter_list;
#endif
struct
{