window creation and resizing problem



I have created application with multiple windows and I want to enable user
to save positions & sizes of windows to file for later use. I can read
window positions and sizes with gdk_window_get_size(...) and
gdk_window_get_root_origin(...) but when I'm trying to set window size and
position like this

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	...
	gtk_widget_realize(GTK_WIDGET(window));
	gw = GTK_WIDGET(window)->window);
	gdk_window_move_resize(gw,x,y,w,h);
	gtk_widget_show(GTK_WIDGET(window));

window will not appear at location (x,y) with the size of (w x h). I can
fix this by setting timeout (and probably idle works as well) function
that resizes and moves created window later and it works correctly with
the same code, but surely is not the right way to handle this.

What I'm making wrong or is this a problem with GTK/GDK setting widget
sizes on fly, because I'm creating this window before calling gtk_main()?

--
Mikko Rantalainen



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