From: Kristian Høgsberg Date: Tue, 12 Apr 2011 13:52:44 +0000 (-0400) Subject: Merge branch 'gdk-backend-wayland' X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=c7514e8f0d19a833257497caff413bb4dfae6eb4;hp=-c;p=~andy%2Fgtk Merge branch 'gdk-backend-wayland' Conflicts: Makefile.am configure.ac gdk/Makefile.am gtk/gtksettings.c gtk/gtkwindow.c --- c7514e8f0d19a833257497caff413bb4dfae6eb4 diff --combined Makefile.am index df52bcc6b,2c6e77be6..050202dd5 --- a/Makefile.am +++ b/Makefile.am @@@ -55,11 -55,11 +55,11 @@@ MAINTAINERCLEANFILES = ## Copy .pc files to target-specific names - gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc gtk+-broadway-3.0.pc: gtk+-3.0.pc -gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc gtk+-wayland-3.0.pc: gtk+-3.0.pc ++gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc gtk+-broadway-3.0.pc gtk+-wayland-3.0.pc: gtk+-3.0.pc rm -f $@ && \ cp gtk+-3.0.pc $@ - gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc: gdk-3.0.pc -gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-wayland-3.0.pc: gdk-3.0.pc ++gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc gdk-wayland-3.0.pc: gdk-3.0.pc rm -f $@ && \ cp gdk-3.0.pc $@ diff --combined configure.ac index 61084e1ea,a37651a29..fc6df9b83 --- a/configure.ac +++ b/configure.ac @@@ -9,9 -9,9 +9,9 @@@ # set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0. m4_define([gtk_major_version], [3]) -m4_define([gtk_minor_version], [0]) -m4_define([gtk_micro_version], [1]) -m4_define([gtk_interface_age], [1]) +m4_define([gtk_minor_version], [1]) +m4_define([gtk_micro_version], [0]) +m4_define([gtk_interface_age], [0]) m4_define([gtk_binary_age], [m4_eval(100 * gtk_minor_version + gtk_micro_version)]) m4_define([gtk_version], @@@ -39,7 -39,7 +39,7 @@@ m4_define([gtk_binary_version], [3.0.0] # required versions of other packages m4_define([glib_required_version], [2.28.0]) -m4_define([pango_required_version], [1.20]) +m4_define([pango_required_version], [1.24.0]) m4_define([atk_required_version], [1.30]) m4_define([cairo_required_version], [1.10.0]) m4_define([gdk_pixbuf_required_version], [2.22.0]) @@@ -297,10 -297,10 +297,14 @@@ AC_ARG_ENABLE(quartz-backend [AS_HELP_STRING([--enable-quartz-backend], [enable the quartz gdk backend])], [backend_set=yes]) +AC_ARG_ENABLE(broadway-backend, + [AC_HELP_STRING([--enable-broadway-backend], + [enable the broadway (HTML5) gdk backend])], + [backend_set=yes]) + AC_ARG_ENABLE(wayland-backend, + [AC_HELP_STRING([--enable-wayland-backend], + [enable the wayland gdk backend])], + [backend_set=yes]) if test -z "$backend_set"; then if test "$platform_win32" = yes; then @@@ -319,7 -319,7 +323,7 @@@ GDK_WINDOWING GIO_PACKAGE=gio-2.0 PANGO_PACKAGES="pango pangocairo" -if test "x$enable_x11_backend" == xyes; then +if test "x$enable_x11_backend" = xyes; then # GDK calls the xlib backend "x11," cairo calls it "xlib." Other # backend names are identical. cairo_backends="$cairo_backends cairo-xlib" @@@ -332,7 -332,7 +336,7 @@@ #define GDK_WINDOWING_X11" fi -if test "x$enable_win32_backend" == xyes; then +if test "x$enable_win32_backend" = xyes; then cairo_backends="$cairo_backends cairo-win32" GDK_BACKENDS="$GDK_BACKENDS win32" backend_immodules="$backend_immodules,ime" @@@ -345,7 -345,7 +349,7 @@@ els AM_CONDITIONAL(USE_WIN32, false) fi -if test "x$enable_quartz_backend" == xyes; then +if test "x$enable_quartz_backend" = xyes; then cairo_backends="$cairo_backends cairo-quartz" GDK_BACKENDS="$GDK_BACKENDS quartz" GDK_WINDOWING="$GDK_WINDOWING @@@ -356,19 -356,21 +360,33 @@@ els AM_CONDITIONAL(USE_QUARTZ, false) fi ++ +if test "x$enable_broadway_backend" == xyes; then + GDK_BACKENDS="$GDK_BACKENDS broadway" + cairo_backends="$cairo_backends cairo" + GDK_WINDOWING="$GDK_WINDOWING +#define GDK_WINDOWING_BROADWAY" + GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lz" + AM_CONDITIONAL(USE_BROADWAY, true) +else + AM_CONDITIONAL(USE_BROADWAY, false) +fi + + if test "x$enable_wayland_backend" == "xyes"; then + # Wayland uses cairo-gl + cairo_backends="$cairo_backends cairo-gl" + GDK_BACKENDS="$GDK_BACKENDS wayland" + GIO_PACKAGE=gio-unix-2.0 + GDK_WINDOWING="$GDK_WINDOWING + #define GDK_WINDOWING_WAYLAND" + WAYLAND_PACKAGES="wayland-client xkbcommon wayland-egl" + AM_CONDITIONAL(USE_WAYLAND, true) + else + AM_CONDITIONAL(USE_WAYLAND, false) + fi + # strip leading space -GDK_BACKENDS=${GDK_BACKENDS/# } +GDK_BACKENDS=${GDK_BACKENDS#* } AC_SUBST(GDK_BACKENDS) @@@ -493,7 -495,7 +511,7 @@@ case $enable_explicit_deps i auto) export SED deplibs_check_method=`(./libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh` - if test "x$deplibs_check_method" '!=' xpass_all || test "x$enable_static" = xyes ; then + if test "x$deplibs_check_method" != xpass_all || test "x$enable_static" = xyes ; then enable_explicit_deps=yes else enable_explicit_deps=no @@@ -888,7 -890,7 +906,7 @@@ GTK_DEP_PACKAGES_FOR_X GTK_DEP_LIBS_FOR_X= X_EXTENSIONS= -if test "x$enable_x11_backend" == xyes; then +if test "x$enable_x11_backend" = xyes; then X_PACKAGES=fontconfig # @@@ -1181,7 -1183,7 +1199,7 @@@ AM_CONDITIONAL(USE_X11, true) # strip leading space - X_EXTENSIONS=${X_EXTENSIONS/# } + X_EXTENSIONS=${X_EXTENSIONS#* } else XPACKAGES= @@@ -1223,7 -1225,7 +1241,7 @@@ f CFLAGS="$saved_cflags" LDFLAGS="$saved_ldflags" - GDK_PACKAGES="$PANGO_PACKAGES $GIO_PACKAGE $X_PACKAGES gdk-pixbuf-2.0 $cairo_backends cairo-gobject" + GDK_PACKAGES="$PANGO_PACKAGES $GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES gdk-pixbuf-2.0 $cairo_backends cairo-gobject" GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES`" GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFLAGS" @@@ -1273,7 -1275,7 +1291,7 @@@ els fi GTK_PACKAGES="atk cairo cairo-gobject gdk-pixbuf-2.0 gio-2.0" -if test "x$enable_x11_backend" == xyes; then +if test "x$enable_x11_backend" = xyes; then GTK_PACKAGES="$GTK_PACKAGES pangoft2" fi GTK_EXTRA_LIBS= @@@ -1645,12 -1647,12 +1663,13 @@@ build/Makefil build/win32/Makefile build/win32/vs9/Makefile gdk/Makefile +gdk/broadway/Makefile gdk/x11/Makefile gdk/win32/Makefile gdk/win32/rc/Makefile gdk/win32/rc/gdk.rc gdk/quartz/Makefile + gdk/wayland/Makefile gdk/tests/Makefile gtk/Makefile gtk/makefile.msc @@@ -1680,8 -1682,8 +1699,8 @@@ perf/Makefil AC_OUTPUT # beautify the immodule list a bit -included_immodules=${included_immodules//,/ } -included_immodules=${included_immodules:-none} +included_immodules=$(echo "${included_immodules}" | $SED 's/,/ /g') +if test -z "${included_immodules}"; then included_immodules="none"; fi echo "" echo " GTK+ $GTK_VERSION" diff --combined gdk/Makefile.am index cc5346b0f,cfacc2a3d..cb1fd545a --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@@ -11,7 -11,7 +11,7 @@@ INTROSPECTION_COMPILER_ARGS = SUBDIRS = $(GDK_BACKENDS) . tests - DIST_SUBDIRS = win32 x11 quartz broadway tests -DIST_SUBDIRS = win32 x11 quartz wayland tests ++DIST_SUBDIRS = win32 x11 quartz broadway wayland tests CLEANFILES = @@@ -92,6 -92,10 +92,6 @@@ gdk_public_h_sources = gdkvisual.h \ gdkwindow.h -gdk_built_public_sources = \ - gdkconfig.h \ - gdkenumtypes.h - gdk_private_headers = \ gdkapplaunchcontextprivate.h \ gdkcursorprivate.h \ @@@ -137,15 -141,14 +137,15 @@@ gdk_built_sources = gdkenumtypes.c \ gdkmarshalers.h \ gdkmarshalers.c \ - $(gdk_built_public_sources) + gdkenumtypes.h # # setup GDK sources and their dependencies # gdkincludedir = $(includedir)/gtk-3.0/gdk -gdkinclude_HEADERS = $(gdk_public_h_sources) $(gdk_built_public_sources) +gdkinclude_HEADERS = $(gdk_public_h_sources) gdkenumtypes.h +nodist_gdkinclude_HEADERS = gdkconfig.h common_sources = \ $(gdk_private_headers) \ @@@ -173,10 -176,10 +173,14 @@@ libgdk_3_la_DEPENDENCIES = win32/libgdk libgdk_3_la_LDFLAGS += -Wl,win32/rc/gdk-win32-res.o -export-symbols $(srcdir)/gdk.def endif # USE_WIN32 +if USE_BROADWAY +libgdk_3_la_LIBADD += broadway/libgdk-broadway.la +endif # USE_BROADWAY + + if USE_WAYLAND + libgdk_3_la_LIBADD += wayland/libgdk-wayland.la + endif + if HAVE_INTROSPECTION introspection_files = \ @@@ -226,7 -229,7 +230,7 @@@ x11_introspection_files = x11/gdkxid.c \ x11/xsettings-client.c \ x11/xsettings-common.c \ - x11/gdkx.h \ + x11/gdkx.h \ x11/gdkx11cursor.h \ x11/gdkx11display.h \ x11/gdkx11property.h \ @@@ -302,12 -305,14 +306,12 @@@ lib_LTLIBRARIES = libgdk-3.l MAINTAINERCLEANFILES = $(gdk_built_sources) stamp-gdkenumtypes.h EXTRA_DIST += $(gdk_built_sources) -EXTRA_HEADERS = install-exec-hook: if DISABLE_EXPLICIT_DEPS $(SHELL) $(top_srcdir)/sanitize-la.sh $(DESTDIR)$(libdir)/libgdk-3.la endif -#note: not gdkconfig.h BUILT_SOURCES = \ $(gdk_built_sources) \ gdkconfig.h diff --combined gdk/gdkdisplaymanager.c index 11b899ccb,6a2d071af..c21ea02c2 --- a/gdk/gdkdisplaymanager.c +++ b/gdk/gdkdisplaymanager.c @@@ -44,14 -44,14 +44,18 @@@ #include "quartz/gdkquartzdisplaymanager.h" #endif +#ifdef GDK_WINDOWING_BROADWAY +#include "broadway/gdkbroadwaydisplaymanager.h" +#endif + #ifdef GDK_WINDOWING_WIN32 #include "win32/gdkwin32.h" #endif + #ifdef GDK_WINDOWING_WAYLAND + #include "wayland/gdkwayland.h" + #endif + /** * SECTION:gdkdisplaymanager * @Short_description: Maintains a list of all open GdkDisplays @@@ -239,15 -239,15 +243,20 @@@ gdk_display_manager_get (void manager = g_object_new (gdk_win32_display_manager_get_type (), NULL); else #endif + #ifdef GDK_WINDOWING_WAYLAND + if (backend == NULL || strcmp (backend, "wayland") == 0) + manager = g_object_new (gdk_wayland_display_manager_get_type (), NULL); + else + #endif #ifdef GDK_WINDOWING_X11 if (backend == NULL || strcmp (backend, "x11") == 0) manager = g_object_new (gdk_x11_display_manager_get_type (), NULL); else +#endif +#ifdef GDK_WINDOWING_BROADWAY + if (backend == NULL || strcmp (backend, "broadway") == 0) + manager = g_object_new (gdk_broadway_display_manager_get_type (), NULL); + else #endif if (backend != NULL) g_error ("Unsupported GDK backend: %s", backend); diff --combined gtk/gtkwindow.c index 1a3c40f6e,23565f3c2..d7cbe7964 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@@ -107,12 -107,13 +107,12 @@@ struct _GtkWindowPrivat GtkWindow *transient_parent; GtkWindowGeometryInfo *geometry_info; GtkWindowGroup *group; + GdkScreen *screen; + GtkApplication *application; GdkModifierType mnemonic_modifier; - GdkScreen *screen; GdkWindowTypeHint gdk_type_hint; - GtkApplication *application; - gdouble opacity; GdkWindow *grip_window; @@@ -146,6 -147,7 +146,6 @@@ guint destroy_with_parent : 1; guint focus_on_map : 1; guint fullscreen_initially : 1; - guint gravity : 5; /* GdkGravity */ guint has_focus : 1; guint has_user_ref_count : 1; guint has_toplevel_focus : 1; @@@ -174,7 -176,6 +174,7 @@@ guint resize_grip_visible : 1; /* don't use, just for "resize- * grip-visible" notification */ + guint gravity : 5; /* GdkGravity */ }; @@@ -412,10 -413,6 +412,10 @@@ static GtkKeyHash *gtk_window_get_key_h static void gtk_window_free_key_hash (GtkWindow *window); static void gtk_window_on_composited_changed (GdkScreen *screen, GtkWindow *window); +static void gtk_window_on_theme_variant_changed (GtkSettings *settings, + GParamSpec *pspec, + GtkWindow *window); +static void gtk_window_set_theme_variant (GtkWindow *window); static GSList *toplevel_list = NULL; static guint window_signals[LAST_SIGNAL] = { 0 }; @@@ -1114,12 -1111,6 +1114,12 @@@ gtk_window_init (GtkWindow *window if (priv->screen) g_signal_connect (priv->screen, "composited-changed", G_CALLBACK (gtk_window_on_composited_changed), window); + +#ifdef GDK_WINDOWING_X11 + g_signal_connect (gtk_settings_get_for_screen (priv->screen), + "notify::gtk-application-prefer-dark-theme", + G_CALLBACK (gtk_window_on_theme_variant_changed), window); +#endif } static void @@@ -1707,7 -1698,7 +1707,7 @@@ gtk_window_set_startup_id (GtkWindow gdk_window = gtk_widget_get_window (widget); #ifdef GDK_WINDOWING_X11 - if (timestamp != GDK_CURRENT_TIME) + if (timestamp != GDK_CURRENT_TIME && GDK_IS_X11_WINDOW(gdk_window)) gdk_x11_window_set_user_time (gdk_window, timestamp); #endif @@@ -2657,12 -2648,12 +2657,12 @@@ gtk_window_set_type_hint (GtkWindo priv = window->priv; if (hint < GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU) - priv->gdk_type_hint = hint; + priv->type_hint = hint; else - priv->gdk_type_hint = GDK_WINDOW_TYPE_HINT_NORMAL; + priv->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL; priv->reset_type_hint = TRUE; - priv->type_hint = hint; + priv->gdk_type_hint = hint; } /** @@@ -2678,7 -2669,7 +2678,7 @@@ gtk_window_get_type_hint (GtkWindow *wi { g_return_val_if_fail (GTK_IS_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL); - return window->priv->type_hint; + return window->priv->gdk_type_hint; } /** @@@ -4286,16 -4277,14 +4286,16 @@@ gtk_window_move (GtkWindow *window /** * gtk_window_get_position: * @window: a #GtkWindow - * @root_x: (out): return location for X coordinate of gravity-determined reference point - * @root_y: (out): return location for Y coordinate of gravity-determined reference point + * @root_x: (out) (allow-none): eturn location for X coordinate of + * gravity-determined reference point, or %NULL + * @root_y: (out) (allow-none): return location for Y coordinate of + * gravity-determined reference point, or %NULL * * This function returns the position you need to pass to - * gtk_window_move() to keep @window in its current position. This - * means that the meaning of the returned value varies with window - * gravity. See gtk_window_move() for more details. - * + * gtk_window_move() to keep @window in its current position. + * This means that the meaning of the returned value varies with + * window gravity. See gtk_window_move() for more details. + * * If you haven't changed the window gravity, its gravity will be * #GDK_GRAVITY_NORTH_WEST. This means that gtk_window_get_position() * gets the position of the top-left corner of the window manager @@@ -4540,12 -4529,6 +4540,12 @@@ gtk_window_finalize (GObject *object g_free (priv->startup_id); +#ifdef GDK_WINDOWING_X11 + g_signal_handlers_disconnect_by_func (gtk_settings_get_default (), + gtk_window_on_theme_variant_changed, + window); +#endif + G_OBJECT_CLASS (gtk_window_parent_class)->finalize (object); } @@@ -4629,7 -4612,8 +4629,8 @@@ gtk_window_show (GtkWidget *widget /* Try to make sure that we have some focused widget */ #ifdef GDK_WINDOWING_X11 - is_plug = GTK_IS_PLUG (window); + is_plug = GDK_IS_X11_WINDOW (gtk_widget_get_window (widget)) && + GTK_IS_PLUG (window); #else is_plug = FALSE; #endif @@@ -4711,9 -4695,6 +4712,9 @@@ gtk_window_map (GtkWidget *widget gdk_window_set_keep_below (toplevel, priv->below_initially); + if (priv->type == GTK_WINDOW_TOPLEVEL) + gtk_window_set_theme_variant (window); + /* No longer use the default settings */ priv->need_default_size = FALSE; priv->need_default_position = FALSE; @@@ -4725,7 -4706,7 +4726,7 @@@ * Some applications use X directly to change the properties; * in that case, we shouldn't overwrite what they did. */ - gdk_window_set_type_hint (gdk_window, priv->type_hint); + gdk_window_set_type_hint (gdk_window, priv->gdk_type_hint); priv->reset_type_hint = FALSE; } @@@ -4999,14 -4980,17 +5000,14 @@@ gtk_window_realize (GtkWidget *widget { #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_WINDOW (gdk_window)) - { - guint32 timestamp = extract_time_from_startup_id (priv->startup_id); - if (timestamp != GDK_CURRENT_TIME) - gdk_x11_window_set_user_time (gdk_window, timestamp); - } - else + { + guint32 timestamp = extract_time_from_startup_id (priv->startup_id); + if (timestamp != GDK_CURRENT_TIME) + gdk_x11_window_set_user_time (gdk_window, timestamp); + } #endif - { - if (!startup_id_is_fake (priv->startup_id)) - gdk_window_set_startup_id (gdk_window, priv->startup_id); - } + if (!startup_id_is_fake (priv->startup_id)) + gdk_window_set_startup_id (gdk_window, priv->startup_id); } /* Icons */ @@@ -7167,7 -7151,7 +7168,7 @@@ gtk_window_compute_hints (GtkWindow * extra_width = requisition.width - TEMPORARY_SIZE; extra_height = requisition.height - TEMPORARY_SIZE; - if (extra_width < 0 || extra_width < 0) + if (extra_width < 0 || extra_height < 0) { g_warning("Toplevel size doesn't seem to directly depend on the " "size of the geometry widget from gtk_window_set_geometry_hints(). " @@@ -7377,13 -7361,16 +7378,16 @@@ gtk_window_present_with_time (GtkWindo if (timestamp == GDK_CURRENT_TIME) { #ifdef GDK_WINDOWING_X11 - GdkDisplay *display; + if (GDK_IS_X11_WINDOW(gdk_window)) + { + GdkDisplay *display; - display = gtk_widget_get_display (GTK_WIDGET (window)); - timestamp = gdk_x11_display_get_user_time (display); - #else - timestamp = gtk_get_current_event_time (); + display = gtk_widget_get_display (GTK_WIDGET (window)); + timestamp = gdk_x11_display_get_user_time (display); + } + else #endif + timestamp = gtk_get_current_event_time (); } gdk_window_focus (gdk_window, timestamp); @@@ -8012,21 -7999,10 +8016,21 @@@ gtk_window_set_screen (GtkWindow *windo if (screen != previous_screen) { if (previous_screen) - g_signal_handlers_disconnect_by_func (previous_screen, - gtk_window_on_composited_changed, window); + { + g_signal_handlers_disconnect_by_func (previous_screen, + gtk_window_on_composited_changed, window); +#ifdef GDK_WINDOWING_X11 + g_signal_handlers_disconnect_by_func (gtk_settings_get_for_screen (previous_screen), + gtk_window_on_theme_variant_changed, window); +#endif + } g_signal_connect (screen, "composited-changed", G_CALLBACK (gtk_window_on_composited_changed), window); +#ifdef GDK_WINDOWING_X11 + g_signal_connect (gtk_settings_get_for_screen (screen), + "notify::gtk-application-prefer-dark-theme", + G_CALLBACK (gtk_window_on_theme_variant_changed), window); +#endif _gtk_widget_propagate_screen_changed (widget, previous_screen); _gtk_widget_propagate_composited_changed (widget); @@@ -8037,34 -8013,6 +8041,34 @@@ gtk_widget_map (widget); } +static void +gtk_window_set_theme_variant (GtkWindow *window) +{ +#ifdef GDK_WINDOWING_X11 + GdkWindow *gdk_window; + gboolean dark_theme_requested; + + g_object_get (gtk_settings_get_for_screen (window->priv->screen), + "gtk-application-prefer-dark-theme", &dark_theme_requested, + NULL); + + gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); + + if (GDK_IS_X11_WINDOW (gdk_window)) + gdk_x11_window_set_theme_variant (gdk_window, + dark_theme_requested ? "dark" : NULL); +#endif +} + +static void +gtk_window_on_theme_variant_changed (GtkSettings *settings, + GParamSpec *pspec, + GtkWindow *window) +{ + if (window->priv->type == GTK_WINDOW_TOPLEVEL) + gtk_window_set_theme_variant (window); +} + static void gtk_window_on_composited_changed (GdkScreen *screen, GtkWindow *window) @@@ -9219,7 -9167,7 +9223,7 @@@ _gtk_window_set_is_toplevel (GtkWindow _gtk_widget_set_is_toplevel (widget, TRUE); /* When a window becomes toplevel after being embedded and anchored - * into another window we need to unset it's anchored flag so that + * into another window we need to unset its anchored flag so that * the hierarchy changed signal kicks in properly. */ _gtk_widget_set_anchored (widget, FALSE);