OK, did a first test, see code below.
This is for Gnome3 shell, x11-libs/gtk±3.24.8:3::gentoo USE="X cups introspection wayland
At first it looks fine, two draw signal emissions when I launch the program from within a shell. There may be reason why it are two. No emission when I move the mouse over its window or move the window around on the desktop. But when that window is the active one and I click into another window on the desktop, so that window will become inactive: 13 emissions, meaning 13 redraws for a custom drawing area. The other direction seems to be much better, when I click again in that test window to make it again active, there is only one draw signal emitted! (So there seems to be no hidden animation involved.) But 13 draw signals for making it inactive? Smells like really bad code.
But that is still OK, making a window inactive does not occur that often. More important is, what happens when widgets like drawing-area are embedded in containers beside scrollbars. Can be a nightmare when code is really bad. Have bad memories, but maybe that was still for old GTK2. Will continue testing…
// https://developer.gnome.org/gnome-devel-demos/stable/hello-world.html.en
// gcc filename.c `pkg-config --cflags --libs gtk+-3.0` -o filename
#include <gtk/gtk.h>
#include <stdio.h>
static gboolean
draw_cb (GtkWidget *widget,
cairo_t *cr,
gpointer data)
{
//cairo_set_source_surface (cr, surface, 0, 0);
//cairo_paint (cr);
printf("draw_cb called\n");
return FALSE;
}
static void
activate (GtkApplication* app,
gpointer user_data)
{
GtkWidget *window;
GtkWidget *label;
window = gtk_application_window_new (app);
label = gtk_label_new ("Hello GNOME!");
g_signal_connect (label, "draw",
G_CALLBACK (draw_cb), NULL);
gtk_container_add (GTK_CONTAINER (window), label);
gtk_window_set_title (GTK_WINDOW (window), "Welcome to GNOME");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 100);
gtk_widget_show_all (window);
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new (NULL, G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}