summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Welsh <contact@evanwelsh.com>2020-12-30 10:34:16 -0600
committerEvan Welsh <contact@evanwelsh.com>2020-12-30 10:34:16 -0600
commitea723ec0d28ec2c5d8788c88f17f3b70503c5e40 (patch)
tree614f7cd41c0f7275ff3529e9661d5adb3d207419
parent330f36008e960991ec55a343841b68fc89524bb4 (diff)
downloadgnome-desktop-wip/gtk4.tar.gz
Initial GTK4 / 4.0 port.wip/gtk4
This is quite rough, but it compiles. bg-crossfade is dropped.
-rw-r--r--docs/reference/gnome-desktop4/gnome-desktop4-docs.sgml (renamed from docs/reference/gnome-desktop3/gnome-desktop3-docs.sgml)0
-rw-r--r--docs/reference/gnome-desktop4/gnome-desktop4-sections.txt (renamed from docs/reference/gnome-desktop3/gnome-desktop3-sections.txt)23
-rw-r--r--docs/reference/gnome-desktop4/gnome-desktop4.types (renamed from docs/reference/gnome-desktop3/gnome-desktop3.types)1
-rw-r--r--docs/reference/gnome-desktop4/meson.build (renamed from docs/reference/gnome-desktop3/meson.build)4
-rw-r--r--libgnome-desktop/gnome-bg-crossfade.c543
-rw-r--r--libgnome-desktop/gnome-bg-crossfade.h76
-rw-r--r--libgnome-desktop/gnome-bg.c63
-rw-r--r--libgnome-desktop/gnome-bg.h7
-rw-r--r--libgnome-desktop/gnome-desktop-4.0-uninstalled.pc.in (renamed from libgnome-desktop/gnome-desktop-3.0-uninstalled.pc.in)4
-rw-r--r--libgnome-desktop/gnome-desktop-4.0.pc.in (renamed from libgnome-desktop/gnome-desktop-3.0.pc.in)6
-rw-r--r--libgnome-desktop/gnome-idle-monitor.c3
-rw-r--r--libgnome-desktop/gnome-rr-debug.c7
-rw-r--r--libgnome-desktop/gnome-rr-private.h19
-rw-r--r--libgnome-desktop/gnome-rr.c44
-rw-r--r--libgnome-desktop/gnome-rr.h4
-rw-r--r--libgnome-desktop/meson.build18
-rw-r--r--libgnome-desktop/test-idle-monitor.c5
-rw-r--r--meson.build14
-rw-r--r--po/Makevars2
-rw-r--r--po/meson.build2
-rw-r--r--tests/wallclock-reftest.c106
21 files changed, 166 insertions, 785 deletions
diff --git a/docs/reference/gnome-desktop3/gnome-desktop3-docs.sgml b/docs/reference/gnome-desktop4/gnome-desktop4-docs.sgml
index e6e111e4..e6e111e4 100644
--- a/docs/reference/gnome-desktop3/gnome-desktop3-docs.sgml
+++ b/docs/reference/gnome-desktop4/gnome-desktop4-docs.sgml
diff --git a/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt b/docs/reference/gnome-desktop4/gnome-desktop4-sections.txt
index 4f189fcd..af423bcd 100644
--- a/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt
+++ b/docs/reference/gnome-desktop4/gnome-desktop4-sections.txt
@@ -18,7 +18,6 @@ gnome_bg_has_multiple_sizes
gnome_bg_changes_with_time
gnome_bg_create_frame_thumbnail
gnome_bg_set_surface_as_root
-gnome_bg_set_surface_as_root_with_crossfade
gnome_bg_get_surface_from_root
GnomeBG
GnomeBGClass
@@ -61,28 +60,6 @@ GNOME_DESKTOP_IS_THUMBNAIL_FACTORY_CLASS
</SECTION>
<SECTION>
-<FILE>gnome-bg-crossfade</FILE>
-<TITLE>GnomeBGCrossfade</TITLE>
-GnomeBGCrossfade
-GnomeBGCrossfadeClass
-gnome_bg_crossfade_new
-gnome_bg_crossfade_set_start_surface
-gnome_bg_crossfade_set_end_surface
-gnome_bg_crossfade_start
-gnome_bg_crossfade_is_started
-gnome_bg_crossfade_stop
-GnomeBGCrossfadePrivate
-<SUBSECTION Standard>
-GNOME_BG_CROSSFADE
-GNOME_IS_BG_CROSSFADE
-GNOME_TYPE_BG_CROSSFADE
-gnome_bg_crossfade_get_type
-GNOME_BG_CROSSFADE_CLASS
-GNOME_IS_BG_CROSSFADE_CLASS
-GNOME_BG_CROSSFADE_GET_CLASS
-</SECTION>
-
-<SECTION>
<FILE>gnome-bg-slide-show</FILE>
<TITLE>GnomeBGSlideShow</TITLE>
GnomeBGSlideShow
diff --git a/docs/reference/gnome-desktop3/gnome-desktop3.types b/docs/reference/gnome-desktop4/gnome-desktop4.types
index dad5c940..056b1a3f 100644
--- a/docs/reference/gnome-desktop3/gnome-desktop3.types
+++ b/docs/reference/gnome-desktop4/gnome-desktop4.types
@@ -1,4 +1,3 @@
-gnome_bg_crossfade_get_type
gnome_bg_get_type
gnome_desktop_thumbnail_factory_get_type
gnome_idle_monitor_get_type
diff --git a/docs/reference/gnome-desktop3/meson.build b/docs/reference/gnome-desktop4/meson.build
index cd89ae7c..16618660 100644
--- a/docs/reference/gnome-desktop3/meson.build
+++ b/docs/reference/gnome-desktop4/meson.build
@@ -6,8 +6,8 @@ ignored_headers = [
'meta-xrandr-shared.h'
]
-gnome.gtkdoc('gnome-desktop3',
- main_sgml: 'gnome-desktop3-docs.sgml',
+gnome.gtkdoc('gnome-desktop4',
+ main_sgml: 'gnome-desktop4-docs.sgml',
ignore_headers: ignored_headers,
scan_args: '--deprecated-guards="GNOME_DISABLE_DEPRECATED"',
mkdb_args: ['--sgml-mode', '--output-format=xml'],
diff --git a/libgnome-desktop/gnome-bg-crossfade.c b/libgnome-desktop/gnome-bg-crossfade.c
deleted file mode 100644
index f254b313..00000000
--- a/libgnome-desktop/gnome-bg-crossfade.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/* gnome-bg-crossfade.h - fade window background between two surfaces
- *
- * Copyright (C) 2008 Red Hat, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License
- * as published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * Author: Ray Strode <rstrode@redhat.com>
-*/
-
-#include <string.h>
-#include <math.h>
-#include <stdarg.h>
-
-#include <gio/gio.h>
-
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-#include <cairo.h>
-
-#define GNOME_DESKTOP_USE_UNSTABLE_API
-#include "gnome-bg.h"
-#include "gnome-bg-crossfade.h"
-
-struct _GnomeBGCrossfadePrivate
-{
- GdkWindow *window;
- int width;
- int height;
- cairo_surface_t *fading_surface;
- cairo_surface_t *end_surface;
- gdouble start_time;
- gdouble total_duration;
- guint timeout_id;
- guint is_first_frame : 1;
-};
-
-enum {
- PROP_0,
- PROP_WIDTH,
- PROP_HEIGHT,
-};
-
-enum {
- FINISHED,
- NUMBER_OF_SIGNALS
-};
-
-static guint signals[NUMBER_OF_SIGNALS] = { 0 };
-
-G_DEFINE_TYPE_WITH_PRIVATE (GnomeBGCrossfade, gnome_bg_crossfade, G_TYPE_OBJECT)
-
-static void
-gnome_bg_crossfade_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GnomeBGCrossfade *fade;
-
- g_assert (GNOME_IS_BG_CROSSFADE (object));
-
- fade = GNOME_BG_CROSSFADE (object);
-
- switch (property_id)
- {
- case PROP_WIDTH:
- fade->priv->width = g_value_get_int (value);
- break;
- case PROP_HEIGHT:
- fade->priv->height = g_value_get_int (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-gnome_bg_crossfade_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GnomeBGCrossfade *fade;
-
- g_assert (GNOME_IS_BG_CROSSFADE (object));
-
- fade = GNOME_BG_CROSSFADE (object);
-
- switch (property_id)
- {
- case PROP_WIDTH:
- g_value_set_int (value, fade->priv->width);
- break;
- case PROP_HEIGHT:
- g_value_set_int (value, fade->priv->height);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-gnome_bg_crossfade_finalize (GObject *object)
-{
- GnomeBGCrossfade *fade;
-
- fade = GNOME_BG_CROSSFADE (object);
-
- gnome_bg_crossfade_stop (fade);
-
- if (fade->priv->fading_surface != NULL) {
- cairo_surface_destroy (fade->priv->fading_surface);
- fade->priv->fading_surface = NULL;
- }
-
- if (fade->priv->end_surface != NULL) {
- g_object_unref (fade->priv->end_surface);
- fade->priv->end_surface = NULL;
- }
-}
-
-static void
-gnome_bg_crossfade_class_init (GnomeBGCrossfadeClass *fade_class)
-{
- GObjectClass *gobject_class;
-
- gobject_class = G_OBJECT_CLASS (fade_class);
-
- gobject_class->get_property = gnome_bg_crossfade_get_property;
- gobject_class->set_property = gnome_bg_crossfade_set_property;
- gobject_class->finalize = gnome_bg_crossfade_finalize;
-
- /**
- * GnomeBGCrossfade:width:
- *
- * When a crossfade is running, this is width of the fading
- * surface.
- */
- g_object_class_install_property (gobject_class,
- PROP_WIDTH,
- g_param_spec_int ("width",
- "Window Width",
- "Width of window to fade",
- 0, G_MAXINT, 0,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-
- /**
- * GnomeBGCrossfade:height:
- *
- * When a crossfade is running, this is height of the fading
- * surface.
- */
- g_object_class_install_property (gobject_class,
- PROP_HEIGHT,
- g_param_spec_int ("height", "Window Height",
- "Height of window to fade on",
- 0, G_MAXINT, 0,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-
- /**
- * GnomeBGCrossfade::finished:
- * @fade: the #GnomeBGCrossfade that received the signal
- * @window: the #GdkWindow the crossfade happend on.
- *
- * When a crossfade finishes, @window will have a copy
- * of the end surface as its background, and this signal will
- * get emitted.
- */
- signals[FINISHED] = g_signal_new ("finished",
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1, G_TYPE_OBJECT);
-}
-
-static void
-gnome_bg_crossfade_init (GnomeBGCrossfade *fade)
-{
- fade->priv = gnome_bg_crossfade_get_instance_private (fade);
-
- fade->priv->fading_surface = NULL;
- fade->priv->end_surface = NULL;
- fade->priv->timeout_id = 0;
-}
-
-/**
- * gnome_bg_crossfade_new:
- * @width: The width of the crossfading window
- * @height: The height of the crossfading window
- *
- * Creates a new object to manage crossfading a
- * window background between two #cairo_surface_ts.
- *
- * Return value: the new #GnomeBGCrossfade
- **/
-GnomeBGCrossfade *
-gnome_bg_crossfade_new (int width,
- int height)
-{
- GObject *object;
-
- object = g_object_new (GNOME_TYPE_BG_CROSSFADE,
- "width", width,
- "height", height, NULL);
-
- return (GnomeBGCrossfade *) object;
-}
-
-static cairo_surface_t *
-tile_surface (cairo_surface_t *surface,
- int width,
- int height)
-{
- cairo_surface_t *copy;
- cairo_t *cr;
-
- if (surface == NULL) {
- copy = gdk_window_create_similar_surface (gdk_get_default_root_window (),
- CAIRO_CONTENT_COLOR,
- width, height);
- } else {
- copy = cairo_surface_create_similar (surface,
- cairo_surface_get_content (surface),
- width, height);
- }
-
- cr = cairo_create (copy);
-
- if (surface != NULL) {
- cairo_pattern_t *pattern;
- cairo_set_source_surface (cr, surface, 0.0, 0.0);
- pattern = cairo_get_source (cr);
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
- } else {
- GtkStyle *style;
- style = gtk_widget_get_default_style ();
- gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
- }
-
- cairo_paint (cr);
-
- if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
- cairo_surface_destroy (copy);
- copy = NULL;
- }
- cairo_destroy (cr);
-
- return copy;
-}
-
-/**
- * gnome_bg_crossfade_set_start_surface:
- * @fade: a #GnomeBGCrossfade
- * @surface: The cairo surface to fade from
- *
- * Before initiating a crossfade with gnome_bg_crossfade_start()
- * a start and end surface have to be set. This function sets
- * the surface shown at the beginning of the crossfade effect.
- *
- * Return value: %TRUE if successful, or %FALSE if the surface
- * could not be copied.
- **/
-gboolean
-gnome_bg_crossfade_set_start_surface (GnomeBGCrossfade *fade,
- cairo_surface_t *surface)
-{
- g_return_val_if_fail (GNOME_IS_BG_CROSSFADE (fade), FALSE);
-
- if (fade->priv->fading_surface != NULL) {
- cairo_surface_destroy (fade->priv->fading_surface);
- fade->priv->fading_surface = NULL;
- }
-
- fade->priv->fading_surface = tile_surface (surface,
- fade->priv->width,
- fade->priv->height);
-
- return fade->priv->fading_surface != NULL;
-}
-
-static gdouble
-get_current_time (void)
-{
- const double microseconds_per_second = (double) G_USEC_PER_SEC;
- double timestamp;
- GTimeVal now;
-
- g_get_current_time (&now);
-
- timestamp = ((microseconds_per_second * now.tv_sec) + now.tv_usec) /
- microseconds_per_second;
-
- return timestamp;
-}
-
-/**
- * gnome_bg_crossfade_set_end_surface:
- * @fade: a #GnomeBGCrossfade
- * @surface: The cairo surface to fade to
- *
- * Before initiating a crossfade with gnome_bg_crossfade_start()
- * a start and end surface have to be set. This function sets
- * the surface shown at the end of the crossfade effect.
- *
- * Return value: %TRUE if successful, or %FALSE if the surface
- * could not be copied.
- **/
-gboolean
-gnome_bg_crossfade_set_end_surface (GnomeBGCrossfade *fade,
- cairo_surface_t *surface)
-{
- g_return_val_if_fail (GNOME_IS_BG_CROSSFADE (fade), FALSE);
-
- if (fade->priv->end_surface != NULL) {
- cairo_surface_destroy (fade->priv->end_surface);
- fade->priv->end_surface = NULL;
- }
-
- fade->priv->end_surface = tile_surface (surface,
- fade->priv->width,
- fade->priv->height);
-
- /* Reset timer in case we're called while animating
- */
- fade->priv->start_time = get_current_time ();
- return fade->priv->end_surface != NULL;
-}
-
-static gboolean
-animations_are_disabled (GnomeBGCrossfade *fade)
-{
- GtkSettings *settings;
- GdkScreen *screen;
- gboolean are_enabled;
-
- g_assert (fade->priv->window != NULL);
-
- screen = gdk_window_get_screen (fade->priv->window);
-
- settings = gtk_settings_get_for_screen (screen);
-
- g_object_get (settings, "gtk-enable-animations", &are_enabled, NULL);
-
- return !are_enabled;
-}
-
-static void
-draw_background (GnomeBGCrossfade *fade)
-{
- if (gdk_window_get_window_type (fade->priv->window) == GDK_WINDOW_ROOT) {
- g_warning ("Crossfade is not supported on ROOT window!");
- } else {
- gdk_window_invalidate_rect (fade->priv->window, NULL, FALSE);
- gdk_window_process_updates (fade->priv->window, FALSE);
- }
-}
-
-static gboolean
-on_tick (GnomeBGCrossfade *fade)
-{
- gdouble now, percent_done;
- cairo_t *cr;
- cairo_status_t status;
-
- g_return_val_if_fail (GNOME_IS_BG_CROSSFADE (fade), FALSE);
-
- now = get_current_time ();
-
- percent_done = (now - fade->priv->start_time) / fade->priv->total_duration;
- percent_done = CLAMP (percent_done, 0.0, 1.0);
-
- /* If it's taking a long time to get to the first frame,
- * then lengthen the duration, so the user will get to see
- * the effect.
- */
- if (fade->priv->is_first_frame && percent_done > .33) {
- fade->priv->is_first_frame = FALSE;
- fade->priv->total_duration *= 1.5;
- return on_tick (fade);
- }
-
- if (fade->priv->fading_surface == NULL) {
- return FALSE;
- }
-
- if (animations_are_disabled (fade)) {
- return FALSE;
- }
-
- /* We accumulate the results in place for performance reasons.
- *
- * This means 1) The fade is exponential, not linear (looks good!)
- * 2) The rate of fade is not independent of frame rate. Slower machines
- * will get a slower fade (but never longer than .75 seconds), and
- * even the fastest machines will get *some* fade because the framerate
- * is capped.
- */
- cr = cairo_create (fade->priv->fading_surface);
-
- cairo_set_source_surface (cr, fade->priv->end_surface,
- 0.0, 0.0);
- cairo_paint_with_alpha (cr, percent_done);
-
- status = cairo_status (cr);
- cairo_destroy (cr);
-
- if (status == CAIRO_STATUS_SUCCESS) {
- draw_background (fade);
- }
- return percent_done <= .99;
-}
-
-static void
-on_finished (GnomeBGCrossfade *fade)
-{
- cairo_pattern_t *pattern;
-
- if (fade->priv->timeout_id == 0)
- return;
-
- g_assert (fade->priv->end_surface != NULL);
-
- pattern = cairo_pattern_create_for_surface (fade->priv->end_surface);
- gdk_window_set_background_pattern (fade->priv->window, pattern);
- cairo_pattern_destroy (pattern);
-
- draw_background (fade);
-
- cairo_surface_destroy (fade->priv->end_surface);
- fade->priv->end_surface = NULL;
-
- g_assert (fade->priv->fading_surface != NULL);
-
- cairo_surface_destroy (fade->priv->fading_surface);
- fade->priv->fading_surface = NULL;
-
- fade->priv->timeout_id = 0;
- g_signal_emit (fade, signals[FINISHED], 0, fade->priv->window);
-}
-
-/**
- * gnome_bg_crossfade_start:
- * @fade: a #GnomeBGCrossfade
- * @window: The #GdkWindow to draw crossfade on
- *
- * This function initiates a quick crossfade between two surfaces on
- * the background of @window. Before initiating the crossfade both
- * gnome_bg_crossfade_start() and gnome_bg_crossfade_end() need to
- * be called. If animations are disabled, the crossfade is skipped,
- * and the window background is set immediately to the end surface.
- **/
-void
-gnome_bg_crossfade_start (GnomeBGCrossfade *fade,
- GdkWindow *window)
-{
- GSource *source;
- GMainContext *context;
- cairo_pattern_t *pattern;
-
- g_return_if_fail (GNOME_IS_BG_CROSSFADE (fade));
- g_return_if_fail (window != NULL);
- g_return_if_fail (fade->priv->fading_surface != NULL);
- g_return_if_fail (fade->priv->end_surface != NULL);
- g_return_if_fail (!gnome_bg_crossfade_is_started (fade));
- g_return_if_fail (gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN);
-
- source = g_timeout_source_new (1000 / 60.0);
- g_source_set_callback (source,
- (GSourceFunc) on_tick,
- fade,
- (GDestroyNotify) on_finished);
- context = g_main_context_default ();
- fade->priv->timeout_id = g_source_attach (source, context);
- g_source_unref (source);
-
- fade->priv->window = window;
- pattern = cairo_pattern_create_for_surface (fade->priv->fading_surface);
- gdk_window_set_background_pattern (fade->priv->window, pattern);
- cairo_pattern_destroy (pattern);
-
- draw_background (fade);
-
- fade->priv->is_first_frame = TRUE;
- fade->priv->total_duration = .75;
- fade->priv->start_time = get_current_time ();
-}
-
-
-/**
- * gnome_bg_crossfade_is_started:
- * @fade: a #GnomeBGCrossfade
- *
- * This function reveals whether or not @fade is currently
- * running on a window. See gnome_bg_crossfade_start() for
- * information on how to initiate a crossfade.
- *
- * Return value: %TRUE if fading, or %FALSE if not fading
- **/
-gboolean
-gnome_bg_crossfade_is_started (GnomeBGCrossfade *fade)
-{
- g_return_val_if_fail (GNOME_IS_BG_CROSSFADE (fade), FALSE);
-
- return fade->priv->timeout_id != 0;
-}
-
-/**
- * gnome_bg_crossfade_stop:
- * @fade: a #GnomeBGCrossfade
- *
- * This function stops any in progress crossfades that may be
- * happening. It's harmless to call this function if @fade is
- * already stopped.
- **/
-void
-gnome_bg_crossfade_stop (GnomeBGCrossfade *fade)
-{
- g_return_if_fail (GNOME_IS_BG_CROSSFADE (fade));
-
- if (!gnome_bg_crossfade_is_started (fade))
- return;
-
- g_assert (fade->priv->timeout_id != 0);
- g_source_remove (fade->priv->timeout_id);
- fade->priv->timeout_id = 0;
-}
diff --git a/libgnome-desktop/gnome-bg-crossfade.h b/libgnome-desktop/gnome-bg-crossfade.h
deleted file mode 100644
index 119047da..00000000
--- a/libgnome-desktop/gnome-bg-crossfade.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* gnome-bg-crossfade.h - fade window background between two surfaces
-
- Copyright 2008, Red Hat, Inc.
-
- This file is part of the Gnome Library.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- Author: Ray Strode <rstrode@redhat.com>
-*/
-
-#ifndef __GNOME_BG_CROSSFADE_H__
-#define __GNOME_BG_CROSSFADE_H__
-
-#ifndef GNOME_DESKTOP_USE_UNSTABLE_API
-#error GnomeBGCrossfade is unstable API. You must define GNOME_DESKTOP_USE_UNSTABLE_API before including gnome-bg-crossfade.h
-#endif
-
-#include <gdk/gdk.h>
-
-G_BEGIN_DECLS
-
-#define GNOME_TYPE_BG_CROSSFADE (gnome_bg_crossfade_get_type ())
-#define GNOME_BG_CROSSFADE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_BG_CROSSFADE, GnomeBGCrossfade))
-#define GNOME_BG_CROSSFADE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_BG_CROSSFADE, GnomeBGCrossfadeClass))
-#define GNOME_IS_BG_CROSSFADE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_BG_CROSSFADE))
-#define GNOME_IS_BG_CROSSFADE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_BG_CROSSFADE))
-#define GNOME_BG_CROSSFADE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_BG_CROSSFADE, GnomeBGCrossfadeClass))
-
-typedef struct _GnomeBGCrossfadePrivate GnomeBGCrossfadePrivate;
-typedef struct _GnomeBGCrossfade GnomeBGCrossfade;
-typedef struct _GnomeBGCrossfadeClass GnomeBGCrossfadeClass;
-
-struct _GnomeBGCrossfade
-{
- GObject parent_object;
-
- GnomeBGCrossfadePrivate *priv;
-};
-
-struct _GnomeBGCrossfadeClass
-{
- GObjectClass parent_class;
-
- void (* finished) (GnomeBGCrossfade *fade, GdkWindow *window);
-};
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GnomeBGCrossfade, g_object_unref)
-
-GType gnome_bg_crossfade_get_type (void);
-GnomeBGCrossfade *gnome_bg_crossfade_new (int width, int height);
-gboolean gnome_bg_crossfade_set_start_surface (GnomeBGCrossfade *fade,
- cairo_surface_t *surface);
-gboolean gnome_bg_crossfade_set_end_surface (GnomeBGCrossfade *fade,
- cairo_surface_t *surface);
-void gnome_bg_crossfade_start (GnomeBGCrossfade *fade,
- GdkWindow *window);
-gboolean gnome_bg_crossfade_is_started (GnomeBGCrossfade *fade);
-void gnome_bg_crossfade_stop (GnomeBGCrossfade *fade);
-
-G_END_DECLS
-
-#endif
diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
index 6a453b63..96f5cb78 100644
--- a/libgnome-desktop/gnome-bg.c
+++ b/libgnome-desktop/gnome-bg.c
@@ -40,7 +40,6 @@ Author: Soren Sandmann <sandmann@redhat.com>
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include "gnome-bg.h"
#include "gnome-bg-slide-show.h"
-#include "gnome-bg-crossfade.h"
#define BG_KEY_PRIMARY_COLOR "primary-color"
#define BG_KEY_SECONDARY_COLOR "secondary-color"
@@ -148,7 +147,7 @@ static gboolean is_different (GnomeBG *bg,
static time_t get_mtime (const char *filename);
static GdkPixbuf *create_img_thumbnail (GnomeBG *bg,
GnomeDesktopThumbnailFactory *factory,
- GdkScreen *screen,
+ GdkDisplay *display,
int dest_width,
int dest_height,
int frame_num);
@@ -879,7 +878,7 @@ draw_once (GnomeBG *bg,
GdkPixbuf *pixbuf;
gint num_monitor;
- /* we just draw on the whole screen */
+ /* we just draw on the whole display */
num_monitor = 0;
rect.x = 0;
@@ -972,17 +971,17 @@ gnome_bg_get_pixmap_size (GnomeBG *bg,
/**
* gnome_bg_create_surface:
* @bg: GnomeBG
- * @window:
+ * @surface:
* @width:
* @height:
*
- * Create a surface that can be set as background for @window.
+ * Create a surface that can be set as background for @surface.
*
* Returns: %NULL on error (e.g. out of X connections)
**/
cairo_surface_t *
gnome_bg_create_surface (GnomeBG *bg,
- GdkWindow *window,
+ GdkSurface *gdk_surface,
int width,
int height)
{
@@ -992,9 +991,9 @@ gnome_bg_create_surface (GnomeBG *bg,
cairo_t *cr;
g_return_val_if_fail (bg != NULL, NULL);
- g_return_val_if_fail (window != NULL, NULL);
+ g_return_val_if_fail (surface != NULL, NULL);
- scale = gdk_window_get_scale_factor (window);
+ scale = gdk_monitor_get_scale_factor (gdk_surface);
if (bg->pixbuf_cache &&
gdk_pixbuf_get_width (bg->pixbuf_cache) != width &&
@@ -1005,7 +1004,7 @@ gnome_bg_create_surface (GnomeBG *bg,
/* has the side effect of loading and caching pixbuf only when in tile mode */
gnome_bg_get_pixmap_size (bg, width, height, &pm_width, &pm_height);
- surface = gdk_window_create_similar_surface (window,
+ surface = gdk_surface_create_similar_surface (gdk_surface,
CAIRO_CONTENT_COLOR,
pm_width, pm_height);
@@ -1018,16 +1017,16 @@ gnome_bg_create_surface (GnomeBG *bg,
}
else {
GdkPixbuf *pixbuf;
- cairo_surface_t *pixbuf_surface;
+ // cairo_surface_t *pixbuf_surface;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
scale * width, scale * height);
gnome_bg_draw (bg, pixbuf);
- pixbuf_surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 0, window);
- cairo_set_source_surface (cr, pixbuf_surface, 0, 0);
+ // pixbuf_surface = gdk_cairo_region_create_from_surface (surface);
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_surface_destroy (pixbuf_surface);
+ // cairo_surface_destroy (pixbuf_surface);
g_object_unref (pixbuf);
}
@@ -1164,7 +1163,7 @@ fit_factor (int from_width, int from_height,
GdkPixbuf *
gnome_bg_create_thumbnail (GnomeBG *bg,
GnomeDesktopThumbnailFactory *factory,
- GdkScreen *screen,
+ GdkDisplay *display,
int dest_width,
int dest_height)
{
@@ -1178,7 +1177,7 @@ gnome_bg_create_thumbnail (GnomeBG *bg,
draw_color (bg, result);
if (bg->placement != G_DESKTOP_BACKGROUND_STYLE_NONE) {
- thumb = create_img_thumbnail (bg, factory, screen, dest_width, dest_height, -1);
+ thumb = create_img_thumbnail (bg, factory, display, dest_width, dest_height, -1);
if (thumb) {
draw_image_for_thumb (bg, thumb, result);
@@ -1566,7 +1565,7 @@ static GdkPixbuf *
scale_thumbnail (GDesktopBackgroundStyle placement,
const char *filename,
GdkPixbuf *thumb,
- GdkScreen *screen,
+ GdkDisplay *display,
int dest_width,
int dest_height)
{
@@ -1584,9 +1583,21 @@ scale_thumbnail (GDesktopBackgroundStyle placement,
if (get_thumb_annotations (thumb, &o_width, &o_height) ||
(filename && get_original_size (filename, &o_width, &o_height))) {
-
- int scr_height = gdk_screen_get_height (screen);
- int scr_width = gdk_screen_get_width (screen);
+
+ GListModel* monitors = gdk_display_get_monitors (display);
+ GdkMonitor *monitor;
+ GdkRectangle scr_rect = { 0, };
+ int i = 0;
+ for (i = 1; i < g_list_model_get_n_items (monitors); i++) {
+ GdkRectangle rect;
+ monitor = g_list_model_get_item (monitors, i);
+ gdk_monitor_get_geometry (monitor, &rect);
+ gdk_rectangle_union (&scr_rect, &rect, &scr_rect);
+ g_object_unref (monitor);
+ }
+ int scr_height = scr_rect.height;
+ int scr_width = scr_rect.width;
+
int thumb_width = gdk_pixbuf_get_width (thumb);
int thumb_height = gdk_pixbuf_get_height (thumb);
double screen_to_dest = fit_factor (scr_width, scr_height,
@@ -1630,7 +1641,7 @@ scale_thumbnail (GDesktopBackgroundStyle placement,
static GdkPixbuf *
create_img_thumbnail (GnomeBG *bg,
GnomeDesktopThumbnailFactory *factory,
- GdkScreen *screen,
+ GdkDisplay *display,
int dest_width,
int dest_height,
int frame_num)
@@ -1645,7 +1656,7 @@ create_img_thumbnail (GnomeBG *bg,
result = scale_thumbnail (bg->placement,
bg->filename,
thumb,
- screen,
+ display,
dest_width,
dest_height);
g_object_unref (thumb);
@@ -1688,7 +1699,7 @@ create_img_thumbnail (GnomeBG *bg,
thumb = scale_thumbnail (bg->placement,
file1,
tmp,
- screen,
+ display,
dest_width,
dest_height);
g_object_unref (tmp);
@@ -1705,14 +1716,14 @@ create_img_thumbnail (GnomeBG *bg,
thumb1 = scale_thumbnail (bg->placement,
file1,
p1,
- screen,
+ display,
dest_width,
dest_height);
thumb2 = scale_thumbnail (bg->placement,
file2,
p2,
- screen,
+ display,
dest_width,
dest_height);
@@ -2268,7 +2279,7 @@ gnome_bg_changes_with_time (GnomeBG *bg)
GdkPixbuf *
gnome_bg_create_frame_thumbnail (GnomeBG *bg,
GnomeDesktopThumbnailFactory *factory,
- GdkScreen *screen,
+ GdkDisplay *display,
int dest_width,
int dest_height,
int frame_num)
@@ -2304,7 +2315,7 @@ gnome_bg_create_frame_thumbnail (GnomeBG *bg,
draw_color (bg, result);
if (bg->placement != G_DESKTOP_BACKGROUND_STYLE_NONE) {
- thumb = create_img_thumbnail (bg, factory, screen, dest_width, dest_height, frame_num + skipped);
+ thumb = create_img_thumbnail (bg, factory, display, dest_width, dest_height, frame_num + skipped);
if (thumb) {
draw_image_for_thumb (bg, thumb, result);
diff --git a/libgnome-desktop/gnome-bg.h b/libgnome-desktop/gnome-bg.h
index a51ccbee..fd6d18c9 100644
--- a/libgnome-desktop/gnome-bg.h
+++ b/libgnome-desktop/gnome-bg.h
@@ -33,7 +33,6 @@
#include <gio/gio.h>
#include <gdesktop-enums.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
-#include <libgnome-desktop/gnome-bg-crossfade.h>
#include <gdesktop-enums.h>
G_BEGIN_DECLS
@@ -78,7 +77,7 @@ const gchar * gnome_bg_get_filename (GnomeBG *bg);
void gnome_bg_draw (GnomeBG *bg,
GdkPixbuf *dest);
cairo_surface_t *gnome_bg_create_surface (GnomeBG *bg,
- GdkWindow *window,
+ GdkSurface *surface,
int width,
int height);
gboolean gnome_bg_get_image_size (GnomeBG *bg,
@@ -89,7 +88,7 @@ gboolean gnome_bg_get_image_size (GnomeBG *bg,
int *height);
GdkPixbuf * gnome_bg_create_thumbnail (GnomeBG *bg,
GnomeDesktopThumbnailFactory *factory,
- GdkScreen *screen,
+ GdkDisplay *screen,
int dest_width,
int dest_height);
gboolean gnome_bg_is_dark (GnomeBG *bg,
@@ -99,7 +98,7 @@ gboolean gnome_bg_has_multiple_sizes (GnomeBG *bg);
gboolean gnome_bg_changes_with_time (GnomeBG *bg);
GdkPixbuf * gnome_bg_create_frame_thumbnail (GnomeBG *bg,
GnomeDesktopThumbnailFactory *factory,
- GdkScreen *screen,
+ GdkDisplay *screen,
int dest_width,
int dest_height,
int frame_num);
diff --git a/libgnome-desktop/gnome-desktop-3.0-uninstalled.pc.in b/libgnome-desktop/gnome-desktop-4.0-uninstalled.pc.in
index 2f1c6803..9587196d 100644
--- a/libgnome-desktop/gnome-desktop-3.0-uninstalled.pc.in
+++ b/libgnome-desktop/gnome-desktop-4.0-uninstalled.pc.in
@@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-Name: gnome-desktop-3.0
+Name: gnome-desktop-4.0
Description: Utility library for loading .desktop files
-Requires: gtk+-3.0 gsettings-desktop-schemas
+Requires: gtk4 gsettings-desktop-schemas
Version: @VERSION@
Libs: ${pc_top_builddir}/${pcfiledir}/libgnome-desktop-3.la
Cflags: -I${pc_top_builddir}/${pcfiledir}/..
diff --git a/libgnome-desktop/gnome-desktop-3.0.pc.in b/libgnome-desktop/gnome-desktop-4.0.pc.in
index a9cef937..eb947128 100644
--- a/libgnome-desktop/gnome-desktop-3.0.pc.in
+++ b/libgnome-desktop/gnome-desktop-4.0.pc.in
@@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-Name: gnome-desktop-3.0
+Name: gnome-desktop-4.0
Description: Utility library for loading .desktop files
-Requires: gtk+-3.0 gsettings-desktop-schemas
+Requires: gtk4 gsettings-desktop-schemas
Version: @VERSION@
Libs: -L${libdir} -lgnome-desktop-3
-Cflags: -I${includedir}/gnome-desktop-3.0
+Cflags: -I${includedir}/gnome-desktop-4.0
diff --git a/libgnome-desktop/gnome-idle-monitor.c b/libgnome-desktop/gnome-idle-monitor.c
index b481c670..f9d8e71f 100644
--- a/libgnome-desktop/gnome-idle-monitor.c
+++ b/libgnome-desktop/gnome-idle-monitor.c
@@ -26,9 +26,6 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
-#if defined(GDK_WINDOWING_WAYLAND)
-#include <gdk/gdkwayland.h>
-#endif
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include "gnome-idle-monitor.h"
diff --git a/libgnome-desktop/gnome-rr-debug.c b/libgnome-desktop/gnome-rr-debug.c
index af578829..86226434 100644
--- a/libgnome-desktop/gnome-rr-debug.c
+++ b/libgnome-desktop/gnome-rr-debug.c
@@ -148,8 +148,8 @@ main (int argc, char *argv[])
GnomeRRScreen *screen;
guint i;
- gtk_init (&argc, &argv);
- screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);
+ gtk_init ();
+ screen = gnome_rr_screen_new (gdk_display_get_default (), &error);
if (screen == NULL) {
g_warning ("failed to get screen: %s", error->message);
g_error_free (error);
@@ -164,7 +164,8 @@ main (int argc, char *argv[])
g_signal_connect (screen, "output-connected", G_CALLBACK (output_connected), NULL);
g_signal_connect (screen, "notify::dpms-mode", G_CALLBACK (dpms_mode_changed), NULL);
- gtk_main ();
+ GMainLoop *loop = g_main_loop_new (NULL, FALSE);
+ g_main_loop_run(loop);
out:
g_object_unref (screen);
diff --git a/libgnome-desktop/gnome-rr-private.h b/libgnome-desktop/gnome-rr-private.h
index 36ad7767..bd5a8dcd 100644
--- a/libgnome-desktop/gnome-rr-private.h
+++ b/libgnome-desktop/gnome-rr-private.h
@@ -1,20 +1,7 @@
#ifndef GNOME_RR_PRIVATE_H
#define GNOME_RR_PRIVATE_H
-#ifdef GDK_WINDOWING_WAYLAND
-#include <gdk/gdkwayland.h>
-#else
-enum wl_output_transform {
- WL_OUTPUT_TRANSFORM_NORMAL,
- WL_OUTPUT_TRANSFORM_90,
- WL_OUTPUT_TRANSFORM_180,
- WL_OUTPUT_TRANSFORM_270,
- WL_OUTPUT_TRANSFORM_FLIPPED,
- WL_OUTPUT_TRANSFORM_FLIPPED_90,
- WL_OUTPUT_TRANSFORM_FLIPPED_180,
- WL_OUTPUT_TRANSFORM_FLIPPED_270
-};
-#endif
+#include <gdk/wayland/gdkwayland.h>
#include "meta-xrandr-shared.h"
#include "meta-dbus-xrandr.h"
@@ -43,8 +30,8 @@ struct ScreenInfo
struct GnomeRRScreenPrivate
{
- GdkScreen * gdk_screen;
- GdkWindow * gdk_root;
+ GdkDisplay * gdk_screen;
+ GdkSurface * gdk_root;
ScreenInfo * info;
int init_name_watch_id;
diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index 692dafaa..e4373989 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -42,7 +42,7 @@
enum {
SCREEN_PROP_0,
- SCREEN_PROP_GDK_SCREEN,
+ SCREEN_PROP_GDK_DISPLAY,
SCREEN_PROP_DPMS_MODE,
SCREEN_PROP_LAST,
};
@@ -834,7 +834,7 @@ gnome_rr_screen_set_property (GObject *gobject, guint property_id, const GValue
switch (property_id)
{
- case SCREEN_PROP_GDK_SCREEN:
+ case SCREEN_PROP_GDK_DISPLAY:
priv->gdk_screen = g_value_get_object (value);
return;
case SCREEN_PROP_DPMS_MODE:
@@ -854,7 +854,7 @@ gnome_rr_screen_get_property (GObject *gobject, guint property_id, GValue *value
switch (property_id)
{
- case SCREEN_PROP_GDK_SCREEN:
+ case SCREEN_PROP_GDK_DISPLAY:
g_value_set_object (value, priv->gdk_screen);
return;
case SCREEN_PROP_DPMS_MODE: {
@@ -885,12 +885,12 @@ gnome_rr_screen_class_init (GnomeRRScreenClass *klass)
g_object_class_install_property(
gobject_class,
- SCREEN_PROP_GDK_SCREEN,
+ SCREEN_PROP_GDK_DISPLAY,
g_param_spec_object (
- "gdk-screen",
- "GDK Screen",
- "The GDK Screen represented by this GnomeRRScreen",
- GDK_TYPE_SCREEN,
+ "gdk-display",
+ "GDK Display",
+ "The GDK Display represented by this GnomeRRScreen",
+ GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS)
@@ -983,43 +983,43 @@ gnome_rr_screen_init (GnomeRRScreen *self)
self->priv = gnome_rr_screen_get_instance_private (self);
}
-/* Weak reference callback set in gnome_rr_screen_new(); we remove the GObject data from the GdkScreen. */
+/* Weak reference callback set in gnome_rr_screen_new(); we remove the GObject data from the GdkDisplay. */
static void
rr_screen_weak_notify_cb (gpointer data, GObject *where_the_object_was)
{
- GdkScreen *screen = GDK_SCREEN (data);
+ GdkDisplay *display = GDK_DISPLAY (data);
- g_object_set_data (G_OBJECT (screen), "GnomeRRScreen", NULL);
+ g_object_set_data (G_OBJECT (display), "GnomeRRScreen", NULL);
}
/**
* gnome_rr_screen_new:
- * @screen: the #GdkScreen on which to operate
+ * @screen: the #GdkDisplay on which to operate
* @error: will be set if XRandR is not supported
*
* Creates a unique #GnomeRRScreen instance for the specified @screen.
*
* Returns: a unique #GnomeRRScreen instance, specific to the @screen, or NULL
* if this could not be created, for instance if the driver does not support
- * Xrandr 1.2. Each #GdkScreen thus has a single instance of #GnomeRRScreen.
+ * Xrandr 1.2. Each #GdkDisplay thus has a single instance of #GnomeRRScreen.
*/
GnomeRRScreen *
-gnome_rr_screen_new (GdkScreen *screen,
+gnome_rr_screen_new (GdkDisplay *display,
GError **error)
{
GnomeRRScreen *rr_screen;
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
- rr_screen = g_object_get_data (G_OBJECT (screen), "GnomeRRScreen");
+ rr_screen = g_object_get_data (G_OBJECT (display), "GnomeRRScreen");
if (rr_screen)
g_object_ref (rr_screen);
else {
- rr_screen = g_initable_new (GNOME_TYPE_RR_SCREEN, NULL, error, "gdk-screen", screen, NULL);
+ rr_screen = g_initable_new (GNOME_TYPE_RR_SCREEN, NULL, error, "gdk-display", display, NULL);
if (rr_screen) {
- g_object_set_data (G_OBJECT (screen), "GnomeRRScreen", rr_screen);
- g_object_weak_ref (G_OBJECT (rr_screen), rr_screen_weak_notify_cb, screen);
+ g_object_set_data (G_OBJECT (display), "GnomeRRScreen", rr_screen);
+ g_object_weak_ref (G_OBJECT (rr_screen), rr_screen_weak_notify_cb, display);
}
}
@@ -1027,15 +1027,15 @@ gnome_rr_screen_new (GdkScreen *screen,
}
void
-gnome_rr_screen_new_async (GdkScreen *screen,
+gnome_rr_screen_new_async (GdkDisplay *display,
GAsyncReadyCallback callback,
gpointer user_data)
{
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_DISPLAY (display));
g_async_initable_new_async (GNOME_TYPE_RR_SCREEN, G_PRIORITY_DEFAULT,
NULL, callback, user_data,
- "gdk-screen", screen, NULL);
+ "gdk-display", display, NULL);
}
GnomeRRScreen *
diff --git a/libgnome-desktop/gnome-rr.h b/libgnome-desktop/gnome-rr.h
index 7b5c92d4..206f7bc2 100644
--- a/libgnome-desktop/gnome-rr.h
+++ b/libgnome-desktop/gnome-rr.h
@@ -117,9 +117,9 @@ GType gnome_rr_mode_get_type (void);
GType gnome_rr_dpms_mode_get_type (void);
/* GnomeRRScreen */
-GnomeRRScreen * gnome_rr_screen_new (GdkScreen *screen,
+GnomeRRScreen * gnome_rr_screen_new (GdkDisplay *screen,
GError **error);
-void gnome_rr_screen_new_async (GdkScreen *screen,
+void gnome_rr_screen_new_async (GdkDisplay *screen,
GAsyncReadyCallback callback,
gpointer user_data);
GnomeRRScreen * gnome_rr_screen_new_finish (GAsyncResult *result,
diff --git a/libgnome-desktop/meson.build b/libgnome-desktop/meson.build
index 483f1ff6..86c9497c 100644
--- a/libgnome-desktop/meson.build
+++ b/libgnome-desktop/meson.build
@@ -13,7 +13,6 @@ introspection_sources = [
'gnome-desktop-thumbnail.c',
'gnome-bg.c',
'gnome-bg-slide-show.c',
- 'gnome-bg-crossfade.c',
'gnome-rr.c',
'gnome-rr-config.c',
'gnome-rr-output-info.c',
@@ -53,7 +52,6 @@ libgnome_desktop_sources = [
libgnome_desktop_headers = [
'gnome-bg.h',
- 'gnome-bg-crossfade.h',
'gnome-bg-slide-show.h',
'gnome-desktop-thumbnail.h',
'gnome-rr.h',
@@ -67,7 +65,7 @@ libgnome_desktop_headers = [
]
install_headers(libgnome_desktop_headers,
- subdir: 'gnome-desktop-3.0/libgnome-desktop'
+ subdir: 'gnome-desktop-4.0/libgnome-desktop'
)
gnome_desktop_deps = [
@@ -109,10 +107,10 @@ libgnome_desktop_dep = declare_dependency(
gnome.generate_gir(libgnome_desktop,
sources: introspection_sources + libgnome_desktop_headers,
- export_packages: 'gnome-desktop-3.0',
+ export_packages: 'gnome-desktop-4.0',
namespace: 'GnomeDesktop',
- nsversion: '3.0',
- includes: ['GObject-2.0', 'Gtk-3.0', 'GDesktopEnums-3.0'],
+ nsversion: '4.0',
+ includes: ['GObject-2.0', 'Gtk-4.0', 'GDesktopEnums-3.0'],
extra_args: '-DGNOME_DESKTOP_USE_UNSTABLE_API',
identifier_prefix: 'Gnome',
symbol_prefix: 'gnome',
@@ -121,12 +119,12 @@ gnome.generate_gir(libgnome_desktop,
desktop_pc = pkg.generate(
libraries: libgnome_desktop,
- requires: ['gtk+-3.0', 'gsettings-desktop-schemas'],
+ requires: ['gtk4', 'gsettings-desktop-schemas'],
version: meson.project_version(),
- name: 'gnome-desktop-3.0',
- filebase: 'gnome-desktop-3.0',
+ name: 'gnome-desktop-4.0',
+ filebase: 'gnome-desktop-4.0',
description: 'Utility library for loading .desktop files',
- subdirs: 'gnome-desktop-3.0'
+ subdirs: 'gnome-desktop-4.0'
)
test_programs = [
diff --git a/libgnome-desktop/test-idle-monitor.c b/libgnome-desktop/test-idle-monitor.c
index 713f12cf..b366364f 100644
--- a/libgnome-desktop/test-idle-monitor.c
+++ b/libgnome-desktop/test-idle-monitor.c
@@ -38,7 +38,7 @@ int main (int argc, char **argv)
GnomeIdleMonitor *monitor;
guint watch_id;
- gtk_init (&argc, &argv);
+ gtk_init ();
monitor = gnome_idle_monitor_new ();
watch_id = gnome_idle_monitor_add_idle_watch (monitor,
@@ -51,7 +51,8 @@ int main (int argc, char **argv)
ensure_active_watch (monitor);
- gtk_main ();
+ GMainLoop *loop = g_main_loop_new (NULL, FALSE);
+ g_main_loop_run(loop);
return 0;
}
diff --git a/meson.build b/meson.build
index 2ec66471..220c1858 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('gnome-desktop', 'c',
meson_version: '>= 0.49.0',
- version: '3.38.0',
+ version: '40.alpha',
license: ['GPL2+', 'LGPL2+']
)
@@ -14,11 +14,11 @@ project('gnome-desktop', 'c',
# to 0. When bumping the second version, set the third one to zero.
#
# A lot easier than libtool, right?
-libversion = '19.0.8'
+libversion = '20.0.0'
soversion = libversion.split('.')[0]
gdk_pixbuf_req = '>= 2.36.5'
-gtk_req = '>= 3.3.6'
+gtk_req = '>= 4.0.0'
glib_req = '>= 2.53.0'
xrandr_req = '>= 1.3'
schemas_req = '>= 3.27.0'
@@ -40,7 +40,7 @@ test_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name())
versiondir = join_paths(datadir, 'gnome')
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req)
-gtk_dep = dependency('gtk+-3.0', version: gtk_req)
+gtk_dep = dependency('gtk4', version: gtk_req)
glib_dep = dependency('glib-2.0', version: glib_req)
gio_dep = dependency('gio-2.0', version: glib_req)
gio_unix_dep = dependency('gio-unix-2.0', version: glib_req)
@@ -81,7 +81,7 @@ endif
conf = configuration_data()
-conf.set_quoted('GETTEXT_PACKAGE', '@0@-3.0'.format(meson.project_name()))
+conf.set_quoted('GETTEXT_PACKAGE', '@0@-4.0'.format(meson.project_name()))
conf.set_quoted('INSTALL_PREFIX', prefix)
conf.set('ENABLE_SECCOMP', seccomp_dep.found())
@@ -109,7 +109,7 @@ version_conf = configuration_data()
version_conf.set('GNOME_PLATFORM', version_array[0])
version_conf.set('GNOME_MINOR', version_array[1])
-version_conf.set('GNOME_MICRO', version_array[2])
+version_conf.set('GNOME_MICRO', 0)
version_conf.set('GNOME_DISTRIBUTOR', get_option('gnome_distributor'))
if get_option('date_in_gnome_version')
@@ -141,5 +141,5 @@ if get_option('desktop_docs')
endif
if get_option('gtk_doc')
- subdir('docs/reference/gnome-desktop3')
+ subdir('docs/reference/gnome-desktop4')
endif
diff --git a/po/Makevars b/po/Makevars
index aeb45289..ef11e1ba 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -1,7 +1,7 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
-DOMAIN = gnome-desktop-3.0
+DOMAIN = gnome-desktop-4.0
# These two variables depend on the location of this directory.
subdir = po
diff --git a/po/meson.build b/po/meson.build
index d1fa7c6f..a9e15ce8 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1 +1 @@
-i18n.gettext('gnome-desktop-3.0', preset: 'glib')
+i18n.gettext('gnome-desktop-4.0', preset: 'glib')
diff --git a/tests/wallclock-reftest.c b/tests/wallclock-reftest.c
index 1238ea89..99a19b06 100644
--- a/tests/wallclock-reftest.c
+++ b/tests/wallclock-reftest.c
@@ -93,9 +93,8 @@ add_extra_css (const char *testname,
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_path (GTK_CSS_PROVIDER (provider),
- css_file,
- NULL);
- gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+ css_file);
+ gtk_style_context_add_provider_for_display (gdk_display_get_default (),
provider,
GTK_STYLE_PROVIDER_PRIORITY_FORCE);
@@ -110,7 +109,7 @@ remove_extra_css (GtkStyleProvider *provider)
if (provider == NULL)
return;
- gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (),
+ gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
provider);
}
@@ -144,30 +143,26 @@ quit_when_idle (gpointer loop)
return G_SOURCE_REMOVE;
}
-static void
-event_handler_func (GdkEvent *event,
- gpointer data)
+static gboolean
+check_for_draw (GdkSurface *surface,
+ cairo_region_t *region,
+ gpointer user_data)
{
- gtk_main_do_event (event);
-}
+ GdkEvent *event = (GdkEvent*)event;
+ GMainLoop *loop = (GMainLoop*)user_data;
-static void
-check_for_draw (GdkEvent *event, gpointer loop)
-{
- if (event->type == GDK_EXPOSE)
- {
- g_idle_add (quit_when_idle, loop);
- gdk_event_handler_set ((GdkEventFunc) event_handler_func, NULL, NULL);
- }
+ g_idle_add (quit_when_idle, loop);
+
+ g_object_disconnect(surface, "render", check_for_draw, loop, NULL);
- gtk_main_do_event (event);
+ return FALSE;
}
static cairo_surface_t *
snapshot_widget (GtkWidget *widget, SnapshotMode mode)
{
cairo_surface_t *surface;
- cairo_pattern_t *bg;
+ // cairo_pattern_t *bg;
GMainLoop *loop;
cairo_t *cr;
@@ -179,43 +174,50 @@ snapshot_widget (GtkWidget *widget, SnapshotMode mode)
* happen if the window is fully obscured by windowed child widgets.
* Alternatively, we could wait for an expose event on widget's window.
* Both of these are rather hairy, not sure what's best. */
- gdk_event_handler_set (check_for_draw, loop, NULL);
- g_main_loop_run (loop);
-
- surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
+
+ GtkNative* native = gtk_widget_get_native(widget);
+ GdkSurface* gdk_surface = gtk_native_get_surface(native);
+ surface = gdk_surface_create_similar_surface (gdk_surface,
CAIRO_CONTENT_COLOR,
gtk_widget_get_allocated_width (widget),
gtk_widget_get_allocated_height (widget));
+ g_object_connect(surface, "render", check_for_draw, loop, NULL);
+ g_main_loop_run (loop);
+
cr = cairo_create (surface);
switch (mode)
{
case SNAPSHOT_WINDOW:
{
- GdkWindow *window = gtk_widget_get_window (widget);
- if (gdk_window_get_window_type (window) == GDK_WINDOW_TOPLEVEL ||
- gdk_window_get_window_type (window) == GDK_WINDOW_FOREIGN)
+ GtkNative *native = gtk_widget_get_native (widget);
+ // TODO: native can be NULL?
+ GdkSurface *surface= gtk_native_get_surface (native);
+ cairo_surface_t* cairo_surface = gdk_surface_create_similar_surface(surface, CAIRO_CONTENT_COLOR, gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget));
+ if (GTK_IS_ROOT(surface) || GTK_IS_NATIVE(surface))
{
/* give the WM/server some time to sync. They need it.
* Also, do use popups instead of toplevls in your tests
* whenever you can. */
- gdk_display_sync (gdk_window_get_display (window));
+ gdk_display_sync (gdk_surface_get_display (surface));
g_timeout_add (500, quit_when_idle, loop);
g_main_loop_run (loop);
}
- gdk_cairo_set_source_window (cr, window, 0, 0);
+ GdkPixbuf* pixbuf = gdk_pixbuf_get_from_surface(cairo_surface, 0, 0, gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget));
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
cairo_paint (cr);
}
break;
case SNAPSHOT_DRAW:
- bg = gdk_window_get_background_pattern (gtk_widget_get_window (widget));
- if (bg)
- {
- cairo_set_source (cr, bg);
- cairo_paint (cr);
- }
- gtk_widget_draw (widget, cr);
+ // TODO:
+ // bg = gdk_window_get_background_pattern (gtk_widget_get_window (widget));
+ // if (bg)
+ // {
+ // cairo_set_source (cr, bg);
+ // cairo_paint (cr);
+ // }
+ // gtk_widget_draw (widget, cr);
break;
default:
g_assert_not_reached();
@@ -224,7 +226,7 @@ snapshot_widget (GtkWidget *widget, SnapshotMode mode)
cairo_destroy (cr);
g_main_loop_unref (loop);
- gtk_widget_destroy (widget);
+ g_object_unref (widget);
return surface;
}
@@ -269,6 +271,34 @@ save_image (cairo_surface_t *surface,
g_free (filename);
}
+// TODO: Removed from GDK
+gboolean
+__gdk_cairo_get_clip_rectangle (cairo_t *cr,
+ GdkRectangle *rect)
+{
+ double x1, y1, x2, y2;
+ gboolean clip_exists;
+
+ cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
+
+ clip_exists = x1 < x2 && y1 < y2;
+
+ if (rect)
+ {
+ x1 = floor (x1);
+ y1 = floor (y1);
+ x2 = ceil (x2);
+ y2 = ceil (y2);
+
+ rect->x = CLAMP (x1, G_MININT, G_MAXINT);
+ rect->y = CLAMP (y1, G_MININT, G_MAXINT);
+ rect->width = CLAMP (x2 - x1, G_MININT, G_MAXINT);
+ rect->height = CLAMP (y2 - y1, G_MININT, G_MAXINT);
+ }
+
+ return clip_exists;
+}
+
static void
get_surface_size (cairo_surface_t *surface,
int *width,
@@ -278,7 +308,7 @@ get_surface_size (cairo_surface_t *surface,
cairo_t *cr;
cr = cairo_create (surface);
- if (!gdk_cairo_get_clip_rectangle (cr, &area))
+ if (!__gdk_cairo_get_clip_rectangle (cr, &area))
{
g_assert_not_reached ();
}
@@ -597,7 +627,7 @@ main (int argc, char **argv)
g_setenv ("GDK_RENDERING", "image", FALSE);
g_test_init (&argc, &argv, NULL);
- gtk_init (&argc, &argv);
+ gtk_init ();
basedir = g_getenv ("G_TEST_SRCDIR");
if (basedir == NULL)