From 8852f3b0881edf76a21f53775dd3b37a023ec4f3 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Mon, 18 Feb 2019 10:08:24 +0100 Subject: frames: avoid deprecated 'gtk_widget_set_double_buffered' based in the mutter commits: https://gitlab.gnome.org/GNOME/mutter/commit/b8b0dc5c78008647f5833f63d88456025f17bd08 https://gitlab.gnome.org/GNOME/mutter/commit/669c9da2a48d9a5573edee09065b8558c1d07035 --- src/ui/frames.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/ui') diff --git a/src/ui/frames.c b/src/ui/frames.c index 816ebd8c..d1a62656 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -198,8 +198,6 @@ meta_frames_init (MetaFrames *frames) frames->invalidate_frames = NULL; frames->cache = g_hash_table_new (g_direct_hash, g_direct_equal); - gtk_widget_set_double_buffered (GTK_WIDGET (frames), FALSE); - meta_prefs_add_listener (prefs_changed_callback, frames); } @@ -2293,6 +2291,21 @@ subtract_client_area (cairo_region_t *region, MetaUIFrame *frame) cairo_region_destroy (tmp_region); } +static MetaUIFrame * +find_frame_to_draw (MetaFrames *frames, + cairo_t *cr) +{ + GHashTableIter iter; + MetaUIFrame *frame; + + g_hash_table_iter_init (&iter, frames->frames); + while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &frame)) + if (gtk_cairo_should_draw_window (cr, frame->window)) + return frame; + + return NULL; +} + static gboolean meta_frames_draw (GtkWidget *widget, cairo_t *cr) @@ -2303,14 +2316,12 @@ meta_frames_draw (GtkWidget *widget, cairo_region_t *region; cairo_rectangle_int_t clip; int i, n_areas; - cairo_surface_t *target; frames = META_FRAMES (widget); - target = cairo_get_target (cr); gdk_cairo_get_clip_rectangle (cr, &clip); - g_assert (cairo_surface_get_type (target) == CAIRO_SURFACE_TYPE_XLIB); - frame = meta_frames_lookup_window (frames, cairo_xlib_surface_get_drawable (target)); + frame = find_frame_to_draw (frames, cr); + if (frame == NULL) return FALSE; -- cgit v1.2.1