Maximize -> WindowHeight() wrong

Linux specific forum
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Maximize -> WindowHeight() wrong

Post 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.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

The correct way to do it with GTk is to create the window invisible, then maximize it, then show it.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Yes, this is our current code.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Ok then it's nothing you can do about it.
Post Reply