Commit b445ee37 authored by Florian Müllner's avatar Florian Müllner
Browse files

Remove compatibility for GTK+-2.0

While the Meego developers agreed to switching mutter to GTK+-3.0
unconditionally a while ago, Canonical used a GTK+-2.0 build for their
Unity project. As Canonical now announced a switch to compiz as their
window manager, there is no longer a reason to maintain GTK+-2.0
compatibility.

https://bugzilla.gnome.org/show_bug.cgi?id=633133
parent 95a7f026
......@@ -127,35 +127,11 @@ if test "$enable_compile_warnings" != no ; then
fi
changequote([,])dnl
AC_MSG_CHECKING([which gtk+ version to compile against])
AC_ARG_WITH([gtk],
AC_HELP_STRING([--with-gtk=3.0|2.0],
[which gtk+ version to compile against (default: 3.0)]),
[case "$with_gtk" in
2.0|3.0) ;;
*) AC_MSG_ERROR([invalid gtk+ version specified]);;
esac],
[with_gtk=3.0])
AC_MSG_RESULT([$with_gtk])
case "$with_gtk" in
2.0) GTK_API_VERSION=2.0
GTK_MIN_VERSION=2.18
CANBERRA_GTK=libcanberra-gtk
CANBERRA_GTK_VERSION=0.24
;;
3.0) GTK_API_VERSION=3.0
GTK_MIN_VERSION=2.90.7
CANBERRA_GTK=libcanberra-gtk3
CANBERRA_GTK_VERSION=0.26
AC_DEFINE(USE_CAIRO_REGION, 1, [Use cairo_region_t instead of GdkRegion])
;;
esac
AM_CONDITIONAL(INSTALL_LIBMUTTER_PRIVATE, test "$with_gtk" = "3.0")
GTK_MIN_VERSION=2.90.7
CANBERRA_GTK=libcanberra-gtk3
CANBERRA_GTK_VERSION=0.26
MUTTER_PC_MODULES="gtk+-$GTK_API_VERSION >= $GTK_MIN_VERSION pango >= 1.2.0 cairo >= 1.10.0"
AC_SUBST(GTK_API_VERSION)
MUTTER_PC_MODULES="gtk+-3.0 >= $GTK_MIN_VERSION pango >= 1.2.0 cairo >= 1.10.0"
AC_ARG_ENABLE(gconf,
AC_HELP_STRING([--disable-gconf],
......@@ -215,8 +191,8 @@ AM_GLIB_GNU_GETTEXT
# GRegex requires Glib-2.14.0
PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.14.0)
# gtk_window_set_icon_name requires gtk2+-2.6.0
PKG_CHECK_MODULES(MUTTER_MESSAGE, gtk+-$GTK_API_VERSION >= $GTK_MIN_VERSION)
PKG_CHECK_MODULES(MUTTER_WINDOW_DEMO, gtk+-$GTK_API_VERSION >= $GTK_MIN_VERSION)
PKG_CHECK_MODULES(MUTTER_MESSAGE, gtk+-3.0 >= $GTK_MIN_VERSION)
PKG_CHECK_MODULES(MUTTER_WINDOW_DEMO, gtk+-3.0 >= $GTK_MIN_VERSION)
# Unconditionally use this dir to avoid a circular dep with gnomecc
GNOME_KEYBINDINGS_KEYSDIR="${datadir}/gnome-control-center/keybindings"
......@@ -574,7 +550,7 @@ fi
dnl ==========================================================================
echo "
mutter-$VERSION (using gtk+-${GTK_API_VERSION}):
mutter-$VERSION
prefix: ${prefix}
source code location: ${srcdir}
......
# Flag build for parallelism; see https://savannah.gnu.org/patch/?6905
.AUTOPARALLEL:
if INSTALL_LIBMUTTER_PRIVATE
lib_LTLIBRARIES = libmutter-private.la
else
noinst_LTLIBRARIES = libmutter-private.la
endif
SUBDIRS=wm-tester tools compositor/plugins
......@@ -44,10 +40,6 @@ mutter_SOURCES= \
compositor/shadow.h \
compositor/tidy/tidy-texture-frame.c \
compositor/tidy/tidy-texture-frame.h \
gdk-compat.h \
gtk-compat.h \
gdk2-drawing-utils.c \
gdk2-drawing-utils.h \
include/compositor.h \
include/meta-plugin.h \
include/meta-window-actor.h \
......@@ -147,8 +139,6 @@ libmutter_private_la_SOURCES= \
include/common.h \
ui/preview-widget.c \
ui/preview-widget.h \
gdk2-drawing-utils.c \
gdk2-drawing-utils.h \
ui/theme-parser.c \
ui/theme.c \
ui/theme.h
......@@ -186,17 +176,11 @@ libmutterinclude_extra_headers = \
ui/preview-widget.h \
include/atomnames.h
if INSTALL_LIBMUTTER_PRIVATE
libmutterincludedir = $(includedir)/mutter/mutter-private
libmutterinclude_HEADERS = \
$(libmutterinclude_base_headers) \
$(libmutterinclude_extra_headers)
else
noinst_HEADERS = \
$(libmutterinclude_base_headers) \
$(libmutterinclude_extra_headers)
endif
mutter_theme_viewer_SOURCES= \
ui/theme-viewer.c
......@@ -226,11 +210,11 @@ Meta-$(api_version).gir: $(G_IR_SCANNER) mutter $(libmutterinclude_HEADERS) $(mu
--warn-all \
--warn-error \
--include=GObject-2.0 \
--include=Gdk-@GTK_API_VERSION@ \
--include=Gtk-@GTK_API_VERSION@ \
--include=Gdk-3.0 \
--include=Gtk-3.0 \
--include=Clutter-1.0 \
--pkg=clutter-1.0 \
--pkg=gtk+-@GTK_API_VERSION@ \
--pkg=gtk+-3.0 \
--include=xlib-2.0 \
--include=xfixes-4.0 \
--program=$$pwd/mutter \
......@@ -305,11 +289,9 @@ CLEANFILES = \
inlinepixbufs.h: $(IMAGES)
$(GDK_PIXBUF_CSOURCE) --raw --build-list $(VARIABLES) >$(srcdir)/inlinepixbufs.h
if INSTALL_LIBMUTTER_PRIVATE
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libmutter-private.pc mutter-plugins.pc
endif
EXTRA_DIST=$(desktopfiles_files) \
$(wmproperties_files) \
......
......@@ -444,7 +444,7 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
XCompositeRedirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
XSync (xdisplay, FALSE);
if (meta_error_trap_pop_with_return (display, FALSE))
if (meta_error_trap_pop_with_return (display))
{
g_warning ("Another compositing manager is running on screen %i",
screen_number);
......@@ -568,7 +568,7 @@ meta_compositor_add_window (MetaCompositor *compositor,
add_win (window);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
}
void
......
......@@ -272,7 +272,7 @@ window_decorated_notify (MetaWindow *mw,
{
meta_error_trap_push (display);
XDamageDestroy (xdisplay, priv->damage);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
priv->damage = None;
}
......@@ -411,7 +411,7 @@ meta_window_actor_dispose (GObject *object)
{
meta_error_trap_push (display);
XDamageDestroy (xdisplay, priv->damage);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
priv->damage = None;
}
......@@ -1582,7 +1582,7 @@ check_needs_pixmap (MetaWindowActor *self)
priv->back_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
if (meta_error_trap_pop_with_return (display) != Success)
{
/* Probably a BadMatch if the window isn't viewable; we could
* GrabServer/GetWindowAttributes/NameWindowPixmap/UngrabServer/Sync
......@@ -1630,7 +1630,7 @@ check_needs_pixmap (MetaWindowActor *self)
full = TRUE;
}
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
priv->needs_pixmap = FALSE;
}
......@@ -1718,7 +1718,7 @@ check_needs_reshape (MetaWindowActor *self)
ShapeBounding,
&n_rects,
&ordering);
meta_error_trap_pop (display, TRUE);
meta_error_trap_pop (display);
if (rects)
{
......@@ -1766,7 +1766,7 @@ meta_window_actor_pre_paint (MetaWindowActor *self)
{
meta_error_trap_push (display);
XDamageSubtract (xdisplay, priv->damage, None, None);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
priv->received_damage = FALSE;
}
......
......@@ -348,7 +348,7 @@ meta_core_lower_beneath_focus_window (Display *xdisplay,
xwindow,
CWSibling | CWStackMode,
&changes);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
}
void
......
......@@ -136,7 +136,7 @@ meta_window_delete (MetaWindow *window,
window->desc);
XKillClient (window->display->xdisplay, window->xwindow);
}
meta_error_trap_pop (window->display, FALSE);
meta_error_trap_pop (window->display);
meta_display_ping_window (window->display,
window,
......@@ -200,7 +200,7 @@ meta_window_kill (MetaWindow *window)
window->desc);
meta_error_trap_push (window->display);
XKillClient (window->display->xdisplay, window->xwindow);
meta_error_trap_pop (window->display, FALSE);
meta_error_trap_pop (window->display);
}
void
......
......@@ -347,7 +347,7 @@ sn_error_trap_pop (SnDisplay *sn_display,
MetaDisplay *display;
display = meta_display_for_x_display (xdisplay);
if (display != NULL)
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
}
#endif
......@@ -890,7 +890,7 @@ meta_display_open (void)
timestamp);
}
meta_error_trap_pop (the_display, FALSE);
meta_error_trap_pop (the_display);
}
meta_display_ungrab (the_display);
......@@ -1099,7 +1099,7 @@ meta_display_screen_for_xwindow (MetaDisplay *display,
meta_error_trap_push (display);
attr.screen = NULL;
result = XGetWindowAttributes (display->xdisplay, xwindow, &attr);
meta_error_trap_pop (display, TRUE);
meta_error_trap_pop (display);
/* Note, XGetWindowAttributes is on all kinds of crack
* and returns 1 on success 0 on failure, rather than Success
......@@ -1492,7 +1492,7 @@ window_raise_with_delay_callback (void *data)
window->xwindow,
&root, &child,
&root_x, &root_y, &x, &y, &mask);
meta_error_trap_pop (window->display, TRUE);
meta_error_trap_pop (window->display);
point_in_window =
(window->frame && POINT_IN_RECT (root_x, root_y, window->frame->rect)) ||
......@@ -2208,7 +2208,7 @@ event_callback (XEvent *event,
window->frame->xwindow);
meta_error_trap_push (display);
meta_window_destroy_frame (window->frame->window);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
}
else
{
......@@ -2377,7 +2377,7 @@ event_callback (XEvent *event,
meta_error_trap_push (display);
XConfigureWindow (display->xdisplay, event->xconfigurerequest.window,
xwcm, &xwc);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
}
else
{
......@@ -3148,7 +3148,7 @@ meta_spew_event (MetaDisplay *display,
meta_error_trap_push (display);
str = XGetAtomName (display->xdisplay,
event->xproperty.atom);
meta_error_trap_pop (display, TRUE);
meta_error_trap_pop (display);
if (event->xproperty.state == PropertyNewValue)
state = "PropertyNewValue";
......@@ -3182,7 +3182,7 @@ meta_spew_event (MetaDisplay *display,
meta_error_trap_push (display);
str = XGetAtomName (display->xdisplay,
event->xclient.message_type);
meta_error_trap_pop (display, TRUE);
meta_error_trap_pop (display);
extra = g_strdup_printf ("type: %s format: %d\n",
str ? str : "(unknown atom)",
event->xclient.format);
......@@ -3460,7 +3460,7 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
meta_topic (META_DEBUG_WINDOW_OPS,
"Changed pointer with XChangeActivePointerGrab()\n");
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
if (meta_error_trap_pop_with_return (display) != Success)
{
meta_topic (META_DEBUG_WINDOW_OPS,
"Error trapped from XChangeActivePointerGrab()\n");
......@@ -3493,7 +3493,7 @@ meta_display_set_grab_op_cursor (MetaDisplay *display,
"XGrabPointer() failed time %u\n",
timestamp);
}
meta_error_trap_pop (display, TRUE);
meta_error_trap_pop (display);
}
#undef GRAB_MASK
......@@ -3669,7 +3669,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
XSyncCAEvents,
&values);
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
if (meta_error_trap_pop_with_return (display) != Success)
display->grab_sync_request_alarm = None;
meta_topic (META_DEBUG_RESIZING,
......@@ -3888,7 +3888,7 @@ meta_change_button_grab (MetaDisplay *display,
{
int result;
result = meta_error_trap_pop_with_return (display, FALSE);
result = meta_error_trap_pop_with_return (display);
if (result != Success)
meta_verbose ("Failed to %s button %d with mask 0x%x for window 0x%lx error code %d\n",
......@@ -3899,7 +3899,7 @@ meta_change_button_grab (MetaDisplay *display,
++ignored_mask;
}
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
}
void
......@@ -4083,7 +4083,7 @@ meta_display_update_active_window_hint (MetaDisplay *display)
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
tmp = tmp->next;
}
......@@ -4363,7 +4363,7 @@ process_request_frame_extents (MetaDisplay *display,
display->atom__NET_FRAME_EXTENTS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 4);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
meta_XFree (hints);
}
......@@ -4841,11 +4841,11 @@ convert_property (MetaDisplay *display,
(unsigned char *)icccm_version, 2);
else
{
meta_error_trap_pop_with_return (display, FALSE);
meta_error_trap_pop_with_return (display);
return FALSE;
}
if (meta_error_trap_pop_with_return (display, FALSE) != Success)
if (meta_error_trap_pop_with_return (display) != Success)
return FALSE;
/* Be sure the PropertyNotify has arrived so we
......@@ -4877,7 +4877,7 @@ process_selection_request (MetaDisplay *display,
meta_error_trap_push (display);
str = XGetAtomName (display->xdisplay,
event->xselectionrequest.selection);
meta_error_trap_pop (display, TRUE);
meta_error_trap_pop (display);
meta_verbose ("Selection request with selection %s window 0x%lx not a WM_Sn selection we recognize\n",
str ? str : "(bad atom)", event->xselectionrequest.owner);
......@@ -4911,11 +4911,11 @@ process_selection_request (MetaDisplay *display,
display->atom_ATOM_PAIR,
&type, &format, &num, &rest, &data) != Success)
{
meta_error_trap_pop_with_return (display, TRUE);
meta_error_trap_pop_with_return (display);
return;
}
if (meta_error_trap_pop_with_return (display, TRUE) == Success)
if (meta_error_trap_pop_with_return (display) == Success)
{
/* FIXME: to be 100% correct, should deal with rest > 0,
* but since we have 4 possible targets, we will hardly ever
......@@ -4938,7 +4938,7 @@ process_selection_request (MetaDisplay *display,
event->xselectionrequest.property,
display->atom_ATOM_PAIR,
32, PropModeReplace, data, num);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
meta_XFree (data);
}
}
......@@ -4994,7 +4994,7 @@ process_selection_clear (MetaDisplay *display,
meta_error_trap_push (display);
str = XGetAtomName (display->xdisplay,
event->xselectionclear.selection);
meta_error_trap_pop (display, TRUE);
meta_error_trap_pop (display);
meta_verbose ("Selection clear with selection %s window 0x%lx not a WM_Sn selection we recognize\n",
str ? str : "(bad atom)", event->xselectionclear.window);
......@@ -5366,7 +5366,7 @@ meta_display_set_input_focus_window (MetaDisplay *display,
focus_frame ? window->frame->xwindow : window->xwindow,
RevertToPointerRoot,
timestamp);
meta_error_trap_pop (display, FALSE);
meta_error_trap_pop (display);
display->expected_focus_window = window;
display->last_focus_time = timestamp;
......
......@@ -28,7 +28,6 @@
#include <errno.h>
#include <stdlib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h> /* Only for GTK_CHECK_VERSION */
/* In GTK+-3.0, the error trapping code was significantly rewritten. The new code
* has some neat features (like knowing automatically if a sync is needed or not
......@@ -41,26 +40,6 @@
* use the GTK+ handling straight-up.
* (See https://bugzilla.gnome.org/show_bug.cgi?id=630216 for restoring logging.)
*/
#if GTK_CHECK_VERSION(2, 90, 0)
#define USE_GDK_ERROR_HANDLERS 1
#endif
#ifndef USE_GDK_ERROR_HANDLERS
static int x_error_handler (Display *display,
XErrorEvent *error);
static int x_io_error_handler (Display *display);
#endif
void
meta_errors_init (void)
{
#ifndef USE_GDK_ERROR_HANDLERS
XSetErrorHandler (x_error_handler);
XSetIOErrorHandler (x_io_error_handler);
#endif
}
#ifdef USE_GDK_ERROR_HANDLERS
void
meta_error_trap_push (MetaDisplay *display)
......@@ -69,8 +48,7 @@ meta_error_trap_push (MetaDisplay *display)
}
void
meta_error_trap_pop (MetaDisplay *display,
gboolean last_request_was_roundtrip)
meta_error_trap_pop (MetaDisplay *display)
{
gdk_error_trap_pop_ignored ();
}
......@@ -82,220 +60,7 @@ meta_error_trap_push_with_return (MetaDisplay *display)
}
int
meta_error_trap_pop_with_return (MetaDisplay *display,
gboolean last_request_was_roundtrip)
meta_error_trap_pop_with_return (MetaDisplay *display)
{
return gdk_error_trap_pop ();
}
#else /* !USE_GDK_ERROR_HANDLERS */
static void
meta_error_trap_push_internal (MetaDisplay *display,
gboolean need_sync)
{
/* GDK resets the error handler on each push */
int (* old_error_handler) (Display *,
XErrorEvent *);
if (need_sync)
{
XSync (display->xdisplay, False);
}
gdk_error_trap_push ();
/* old_error_handler will just be equal to x_error_handler
* for nested traps
*/
old_error_handler = XSetErrorHandler (x_error_handler);
/* Replace GDK handler, but save it so we can chain up */
if (display->error_trap_handler == NULL)
{
g_assert (display->error_traps == 0);
display->error_trap_handler = old_error_handler;
g_assert (display->error_trap_handler != x_error_handler);
}
display->error_traps += 1;
meta_topic (META_DEBUG_ERRORS, "%d traps remain\n", display->error_traps);
}
static int
meta_error_trap_pop_internal (MetaDisplay *display,
gboolean need_sync)
{
int result;
g_assert (display->error_traps > 0);
if (need_sync)
{
XSync (display->xdisplay, False);
}
result = gdk_error_trap_pop ();
display->error_traps -= 1;
if (display->error_traps == 0)
{
/* check that GDK put our handler back; this
* assumes that there are no pending GDK traps from GDK itself
*/
int (* restored_error_handler) (Display *,
XErrorEvent *);
restored_error_handler = XSetErrorHandler (x_error_handler);
/* remove this */
display->error_trap_handler = NULL;
}
meta_topic (META_DEBUG_ERRORS, "%d traps\n", display->error_traps);
return result;
}
void
meta_error_trap_push (MetaDisplay *display)
{
meta_error_trap_push_internal (display, FALSE);
}
void
meta_error_trap_pop (MetaDisplay *display,
gboolean last_request_was_roundtrip)
{
gboolean need_sync;
/* we only have to sync when popping the outermost trap */
need_sync = (display->error_traps == 1 && !last_request_was_roundtrip);
if (need_sync)
meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_pop, traps = %d, roundtrip = %d\n",
display->error_traps, last_request_was_roundtrip);
display->error_trap_synced_at_last_pop = need_sync || last_request_was_roundtrip;
meta_error_trap_pop_internal (display, need_sync);
}
void
meta_error_trap_push_with_return (MetaDisplay *display)
{
gboolean need_sync;
/* We don't sync on push_with_return if there are no traps
* currently, because we assume that any errors were either covered
* by a previous pop, or were fatal.
*
* More generally, we don't sync if we were synchronized last time
* we popped. This is known to be the case if there are no traps,
* but we also keep a flag so we know whether it's the case otherwise.
*/
if (!display->error_trap_synced_at_last_pop)
need_sync = TRUE;
else
need_sync = FALSE;
if (need_sync)
meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_push_with_return, traps = %d\n",
display->error_traps);
meta_error_trap_push_internal (display, FALSE);
}
int
meta_error_trap_pop_with_return (MetaDisplay *display,
gboolean last_request_was_roundtrip)
{
if (!last_request_was_roundtrip)
meta_topic (META_DEBUG_SYNC, "Syncing on error_trap_pop_with_return, traps = %d, roundtrip = %d\n",
display->error_traps, last_request_was_roundtrip);
display->error_trap_synced_at_last_pop = TRUE;
return meta_error_trap_pop_internal (display,
!last_request_was_roundtrip);
}
static int
x_error_handler (Display *xdisplay,
XErrorEvent *error)
{
int retval;
gchar buf[64];
MetaDisplay *display;
XGetErrorText (xdisplay, error->error_code, buf, 63);
display = meta_display_for_x_display (xdisplay);
/* Display can be NULL here Xlib only has one global error handler; and
* there might be other displays open in the process.
*/
if (display && display->error_traps > 0)
{
/* we're in an error trap, chain to the trap handler
* saved fro