]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
gtk2: do not make floating windows minimizable
authorThomas Debesse <dev@illwieckz.net>
Sat, 13 Jul 2019 20:56:48 +0000 (22:56 +0200)
committerThomas Debesse <dev@illwieckz.net>
Sat, 13 Jul 2019 21:18:09 +0000 (23:18 +0200)
First, this feature leads to an horrible behavior on
Windows where the application ends in a loop of endless
minimization and restoration, probably because the window
manager minimizes or restores the whole application once
a floating window in minimized or restored, leading to a
race condition between all floating windows, some being
minimized and others being restored at the same time,
triggering the minimization and the restoration of the
others, and so on. It's difficult to say such issue
will never happen on other OS or with some window manager.

Second, those floating windows are expected to be displayed
or hidden using menu or keyboard shortcut, it's a design
choice. Then the OS-specific way to minimize/restore them
is superflous and less efficient.

Finally, the mainframe is not created as a floating window
so the user minimizes the application by minimizing the
mainframe.

libs/gtkutil/window.cpp

index 4c4536605fe799bcb6687b5c8b186b4137b98173..50bc6df7c1abd2fe66932df757693e9f3b965f91 100644 (file)
@@ -95,6 +95,19 @@ ui::Window create_floating_window( const char* title, ui::Window parent ){
        ui::Window window = ui::Window( ui::window_type::TOP );
        gtk_window_set_title( window, title );
 
+       /* Workaround: Windows minimizes the whole application including all the floating windows when
+        * one floating windows is minimized, this leads to an infinite loop of minimize/restore events,
+        * probably because of some race condition betwen all floating windows not having the same state
+        * at the same time, some being minimized while being restored at the same time, triggering the
+        * minimization and the restoration of the others, and so on.
+        * It's difficult to say such bug will never happen on other OS or with some window manager.
+        * Design choice: those floating windows are made to be displayed/hidden using menu or shortcuts,
+        * then the OS-specific way to minimize/restore them is superfluous and less efficient.
+        * The mainframe is not a floating window and is not created using this function so the user
+        * minimizes the application by minimizing the mainframe.
+        */
+       gtk_window_set_type_hint( window, GDK_WINDOW_TYPE_HINT_MENU );
+
        if ( parent ) {
                gtk_window_set_transient_for( window, parent );
                connect_floating_window_destroy_present( window, parent );