Forcing expose before onscreen mapping

When a GtkWindow first appears after gtk_widget_show() is called on
it, there is a moment during which it isn't yet rendered, and the X11
window's space is filled with all white background.

I understand that this is an artifact of the normal allocate -> map ->
expose progression. Is there a way to force that the window already
has a rendered copy of itself available for the first refresh cycle,
so that applications don't flicker to/from white at startup?

I tried something like:

 GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

 ... add some children to the window ...

 GtkAllocation a;
 a.x = 0;
 a.y = 0;
 a.width = 100;
 a.height = 100;

 gtk_widget_realize (w);
 gtk_widget_size_allocate (w, &a);
 gdk_window_invalidate_rect (w->window, &w->allocation, TRUE);
 gdk_window_process_updates (w->window, TRUE);

 gtk_widget_show (w);

That's an attempt to force allocation of the underlying X resources
(and subsequent painting) before marking the window visible. The same
flickering still happens at startup, though. Can anything else be

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