If I want some function to be called when a window gets closed I connect with delete_event. What should I connect with if I want the function to be called when the user minimizes a Gtk Window. Something like: minimize_event? I couldn’t find anything in the docs.
If I want some function to be called when a window gets closed I
Share
I was at the very same crossroads, wth only some info and code on python gtk, but not in C.
After looking the docs again and again I realized I got confuse by same sounding names, unions, structures and enums and bitfields. I was handling things as booleans, when it was a bitfield thingy all along.
First:
Then:
Remember this are bitfields and
&is the “bit and” operator not the boolean&&.GDK_WINDOW_STATE_ICONIFIED =2or10in binaryand
event->new_window_stateis anintof which the second bit is activeA Widget can be both maximized and minimized at the same time,
GDK_WINDOW_STATE_MAXIMIZED = 4or100If you minimized a maximized window its
event->new_window_state = 6or 110You can experiment and see what works best for you.
More info:
Final Beware and caveats:
I’m using gtk+2, because of dual win&lin development. The newer gtk+3 might do some things different.
The Gnome Developer Site site has some links broken or wrong, or partially re-writen, with some errors. The page on the first url I put above has
while the manual in the source code as well as other downloadable manuals has the correct:
The page also has the incorrect or broken link for the gtk3 page for
GdkEventWindowState.The gtk+3 version seems as wrong as the gtk+2, I have not seen the gtk+3 manuals with the source code or separate so I don’t know if gtk+3 truly modifies the callback for the event and the gdk structures
For the moment as gtk+3 stabilizes*expect* inconsistencies. Use preferably the manuals that came with your source code or linux distro and version gtk+2.
I hope this helps.