From: Thomas Debesse Date: Sun, 4 Aug 2019 19:29:24 +0000 (+0200) Subject: floating window: use HINT_UTILITY on Windows but normal window everywhere else, ref... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b7d6b557a5534c979f9849a741e69092751c282c;p=xonotic%2Fnetradiant.git floating window: use HINT_UTILITY on Windows but normal window everywhere else, ref !140 !147 GDK_WINDOW_TYPE_HINT_UTILITY would have been a good option for any OS but KDE is known to be broken (such window is not put in focus). We must use GDK_WINDOW_TYPE_HINT_UTILITY on Windows to be sure the window is resizeable and to avoid the infinite minimize-restore loop. <3 @SpiKe --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 35ca21d6..7be16fb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,8 +139,12 @@ if (BUILD_RADIANT) set(GTK_TARGET 2 CACHE STRING "GTK target") add_definitions(-DGTK_TARGET=${GTK_TARGET}) - if (GTK_TARGET EQUAL 2 AND WIN32) - add_definitions(-DWORKAROUND_WINDOWS_GTK2_GLWIDGET=1) + if (WIN32) + add_definitions(-DWORKAROUND_WINDOWS_FLOATING_WINDOW=1) + + if (GTK_TARGET EQUAL 2) + add_definitions(-DWORKAROUND_WINDOWS_GTK2_GLWIDGET=1) + endif () endif () endif () diff --git a/Makefile b/Makefile index 295397aa..7e292245 100644 --- a/Makefile +++ b/Makefile @@ -200,7 +200,7 @@ ifeq ($(OS),Linux) else ifeq ($(OS),Win32) - CPPFLAGS_COMMON += -DWIN32 -D_WIN32 -D_inline=inline -DWORKAROUND_WINDOWS_GTK2_GLWIDGET=1 + CPPFLAGS_COMMON += -DWIN32 -D_WIN32 -D_inline=inline -DWORKAROUND_WINDOWS_FLOATING_WINDOW=1 -DWORKAROUND_WINDOWS_GTK2_GLWIDGET=1 CFLAGS_COMMON += -mms-bitfields LDFLAGS_DLL = -Wl,--add-stdcall-alias LIBS_COMMON = -lws2_32 -luser32 -lgdi32 -lole32 diff --git a/libs/gtkutil/window.cpp b/libs/gtkutil/window.cpp index cb1b59c7..80b79738 100644 --- a/libs/gtkutil/window.cpp +++ b/libs/gtkutil/window.cpp @@ -101,12 +101,18 @@ ui::Window create_floating_window( const char* title, ui::Window parent ){ * 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. + * While it's possible to decide this can be a design choihce since those floating windows are made + * to be displayed/hidden using menu or shortcuts, meaning the OS-specific way to minimize/restore + * them is superfluous and less efficient, the floating window mode that fixes issues on Windows + * is also known to be broken on KDE (the floating window does not get focus), this is likely to be + * a bug in kwin. + * In any way the mainframe is not a floating window and is not created using this function so the + * user minimizes the whole application including floating windows by minimizing the mainframe */ + +#ifdef WORKAROUND_WINDOWS_FLOATING_WINDOW gtk_window_set_type_hint( window, GDK_WINDOW_TYPE_HINT_UTILITY ); +#endif // WORKAROUND_WINDOWS_FLOATING_WINDOW if ( parent ) { gtk_window_set_transient_for( window, parent );