[gnome-shell/wip/rstrode/login-screen-extensions: 87/134] perf-helper: Add content for custom drawing




commit 3947b44fe7247e4658e844b70de3ffa4a78b4bcd
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Dec 5 14:12:47 2019 +0100

    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

 src/shell-perf-helper.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/shell-perf-helper.c b/src/shell-perf-helper.c
index e5eab208ba..55bdbef02e 100644
--- a/src/shell-perf-helper.c
+++ b/src/shell-perf-helper.c
@@ -120,9 +120,9 @@ on_window_map_event (GtkWidget   *window,
 }
 
 static gboolean
-on_window_draw (GtkWidget  *window,
-               cairo_t    *cr,
-                WindowInfo *info)
+on_child_draw (GtkWidget  *window,
+               cairo_t    *cr,
+               WindowInfo *info)
 {
   cairo_rectangle_int_t allocation;
   double x_offset, y_offset;
@@ -204,6 +204,7 @@ create_window (int      width,
                gboolean redraws)
 {
   WindowInfo *info;
+  GtkWidget *child;
 
   info = g_new0 (WindowInfo, 1);
   info->width = width;
@@ -219,10 +220,13 @@ create_window (int      width,
   info->pending = TRUE;
   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_app_paintable (info->window, TRUE);
   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);
 
   if (info->redraws)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]