perf-helper: Add content for custom drawing

Drawing windows got a lot more involved with the advent of client-side
decorations. Instead of accounting for visible and invisible borders,
titlebar and shadows when necessary, just add an empty child for the
custom drawing.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/887
This commit is contained in:
Florian Müllner 2019-12-05 14:12:47 +01:00
parent 2ba4108838
commit 3c4c37e4d0

View File

@ -119,7 +119,7 @@ on_window_map_event (GtkWidget *window,
} }
static gboolean static gboolean
on_window_draw (GtkWidget *window, on_child_draw (GtkWidget *window,
cairo_t *cr, cairo_t *cr,
WindowInfo *info) WindowInfo *info)
{ {
@ -203,6 +203,7 @@ create_window (int width,
gboolean redraws) gboolean redraws)
{ {
WindowInfo *info; WindowInfo *info;
GtkWidget *child;
info = g_new0 (WindowInfo, 1); info = g_new0 (WindowInfo, 1);
info->width = width; info->width = width;
@ -218,10 +219,13 @@ create_window (int width,
info->pending = TRUE; info->pending = TRUE;
info->start_time = -1; info->start_time = -1;
child = g_object_new (GTK_TYPE_BOX, "visible", TRUE, "app-paintable", TRUE, NULL);
gtk_container_add (GTK_CONTAINER (info->window), child);
gtk_widget_set_size_request (info->window, width, height); gtk_widget_set_size_request (info->window, width, height);
gtk_widget_set_app_paintable (info->window, TRUE); gtk_widget_set_app_paintable (info->window, TRUE);
g_signal_connect (info->window, "map-event", G_CALLBACK (on_window_map_event), info); g_signal_connect (info->window, "map-event", G_CALLBACK (on_window_map_event), info);
g_signal_connect (info->window, "draw", G_CALLBACK (on_window_draw), info); g_signal_connect (child, "draw", G_CALLBACK (on_child_draw), info);
gtk_widget_show (info->window); gtk_widget_show (info->window);
if (info->redraws) if (info->redraws)