Page 1 of 1

Maximize -> WindowHeight() wrong

Posted: Sat Feb 24, 2007 3:13 pm
by Trond

Code: Select all

OpenWindow(0, 0, 0, 640, 100, "", #PB_Window_SystemMenu | #PB_Window_Maximize | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
Debug WindowHeight(0)
The debug value should give the height of the maximized window, not the restored one (100). This would be fixed automatically if the window maximized correctly in the first place. It should be created maximized, not created and then maximized.

There is another problem: A sizewindow event is sent when the window is created with the #PB_Window_Maximize flag.

Posted: Sun Apr 01, 2007 10:50 am
by Fred
I said it was fixed, but in fact it can't. GTK doesn't provide a way to create a window already maximized, so you will need to watch the #PB_Event_Size to adjust yuour gadgets. Also the WindowWIdth()/Height() will reflect the values at the creation. This is a slight OS difference against Windows.

Posted: Sun Apr 08, 2007 9:25 pm
by Trond
The correct way to do it with GTk is to create the window invisible, then maximize it, then show it.

Posted: Sun Apr 08, 2007 10:20 pm
by Fred
the problem is the following: the maximize order is queued until the window is really displayed ('mapped') by the XServer and is performed by the WindowManager (not by GTK itself). If it was that easy, i wouldn't argue.. Of course, if you can provide and API example which show another way to do it, it's welcome.

Posted: Mon Apr 09, 2007 10:32 am
by Trond
Edit: It looks like you already do this now.

Although for some reason the size isn't updated, the window is actually maximized when it is shown for the first time with this code: (It both looks good and the GTk docs says that the window is directly maximized.)

Code: Select all

gtk_init_(0, 0)

window = gtk_window_new_(#GTK_WINDOW_TOPLEVEL)
gtk_window_set_default_size_(window, 512, 384)
gtk_window_maximize_(window)
gtk_widget_show_(window)

gtk_main_()
It doesn't fix the size problem but at least it looks ok.

Posted: Mon Apr 09, 2007 11:20 am
by Fred
Yes, this is our current code.

Posted: Mon Apr 09, 2007 1:23 pm
by Trond
Ok then it's nothing you can do about it.