GtkWindow show and move



I have a fragment of code similar to this:

gtk_widget_show_all (window);
gtk_window_resize (window, ...);

The problem is that sometimes the specified window starts with the
size I set and sometimes it doesn't. This problem occurs in both debug
& release versions, and it seems to be completely random. What I know
is that before a window is shown the resize function acts differently.
It seems that it works well after the window is shown so as such it is
a timing issue. If for example I delay for a second between these two
lines with g_usleep(1000000); everything would be fine. How can I
solve the problem without introducing any artificial solutions such as
delays and the similar? Should I try to purge the message queue
running gtk_main_iteration while gtk_main_events_pending? Would it
make a difference if I use functions like gtk_widget_request_size and
the alike requests?

Atanas



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