Draw signal - get who send the signal?

I have a draw signal callback on a GtkWindow. For specific reasons I have to send gtk_widget_queue_draw() that will end on the draw signal. On the callback, I have to know if I have send the signal.

g_signal_connect(gtk_widget, "draw", G_CALLBACK(ctx_draw_callback), ctx);

static gboolean ctx_draw_callback(GtkWidget *widget, cairo_t* cr, gpointer user_data) {
    return TRUE;

How can I know if I have sent the signal?

You never “send” (or “emit”, as it would be properly called) the signal yourself.

Calling gtk_widget_queue_draw() queues—as the name implies—a draw operation on the widget, which will cause the whole window to be redrawn. The actual emission of the “draw” signal happens whenever the toolkit is ready to redraw each widget.

You cannot—and you should not—differentiate between your programmatic calls to gtk_widget_queue_draw() and any other draw operation that has been queued by other widgets in your application, or by the toolkit when it receives a redraw request from the windowing system.

Thanks. I’ll rework it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.