frames: Hackily adapt to GTK+ drawing changes

mutter is quite bad at using GTK+ correctly, relying on dumb things
like the single-buffering stuff. Hack up a temporary fix for the
newer GTK+ rendering changes.
This commit is contained in:
Jasper St. Pierre 2014-06-21 13:28:35 -04:00
parent d0cafab836
commit b8b0dc5c78

View File

@ -224,8 +224,6 @@ meta_frames_init (MetaFrames *frames)
update_style_contexts (frames); update_style_contexts (frames);
gtk_widget_set_double_buffered (GTK_WIDGET (frames), FALSE);
meta_prefs_add_listener (prefs_changed_callback, frames); meta_prefs_add_listener (prefs_changed_callback, frames);
} }
@ -1745,6 +1743,23 @@ meta_frames_get_mask (MetaFrames *frames,
cairo_restore (cr); cairo_restore (cr);
} }
/* XXX -- this is disgusting. Find a better approach here.
* Use multiple widgets? */
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, (gpointer *) &frame, NULL))
if (gtk_cairo_should_draw_window (cr, frame->window))
return frame;
return NULL;
}
static gboolean static gboolean
meta_frames_draw (GtkWidget *widget, meta_frames_draw (GtkWidget *widget,
cairo_t *cr) cairo_t *cr)
@ -1753,14 +1768,11 @@ meta_frames_draw (GtkWidget *widget,
MetaFrames *frames; MetaFrames *frames;
cairo_rectangle_int_t clip; cairo_rectangle_int_t clip;
cairo_region_t *region; cairo_region_t *region;
cairo_surface_t *target;
frames = META_FRAMES (widget); frames = META_FRAMES (widget);
target = cairo_get_target (cr);
gdk_cairo_get_clip_rectangle (cr, &clip); gdk_cairo_get_clip_rectangle (cr, &clip);
g_assert (cairo_surface_get_type (target) == CAIRO_SURFACE_TYPE_XLIB); frame = find_frame_to_draw (frames, cr);
frame = meta_frames_lookup_window (frames, cairo_xlib_surface_get_drawable (target));
if (frame == NULL) if (frame == NULL)
return FALSE; return FALSE;