Open GWRon opened 7 months ago
Maybe a resizeable window just does not need the "rethink"-content (resizing to some calculated height). Maybe this was just added for resizeable windows to "fit" to the content "automagically"
Maybe it is already enough to call "layoutKids()" instead of resizing a window when the event happens.
Function OnWindowSize(widget:Byte Ptr, obj:Object)
Local win:TGTKWindow = TGTKWindow(obj)
If win Then
If win.ClientHeight() <> win.oldCH Or win.ClientWidth() <> win.oldCW Then
win.oldCH = win.ClientHeight()
win.oldCW = win.ClientWidth()
'here ... maybe just TGTKWindow(obj).LayoutKids() would do?
TGTKContainer(obj).rethink()
End If
End If
End Function
Yet https://www.cs.hunter.cuny.edu/~sweiss/course_materials/csci493.70/lecture_notes/GTK_Lesson_03.pdf describes the event "check-resize" (which is calling the OnWindowSize() as:
This is emitted when the container is checking whether it has to resize itself to make room for its children
Which sounds like in there it should look if the "kids" have enough space (the 3 buttons in the sample have enough space...)
While thinkering with some issues I spotted something interesting:
This example here (from createbutton.bmx):
On a click on one of the buttons the window will resize.
But when doing this in a default Ubuntu 23.10 installation this resizes the window way bigger..
I then added some debug prints to the "Method rethink" of the TGTKWindow type
Mint 22 (working nicely):
But on Ubuntu 23 this is printed:
So wait ... Ubuntu has these nice animations when changing things ... so resizing "swishes" into the new size.
in
initWindow()
gtkgadget.bmx contains this:And this is fired for for multiple steps of this "animation". OnWindowSize then is resulting in calls to "rethink()" which itself does the
gtk_window_resize
we used to "init" the resize already.Disabling the animation (settings -> accessibility -> reduce animations) makes it work correct again.