From ab8fdcb2734218295d9b213fa47c926cf8f23ee7 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 9 May 2016 23:13:49 +0000 Subject: [PATCH] GTK: don't set the "Keep above" hint on text window. This hint is not recommended for direct use by applications, and for a good reason: it's very annoying. Moreover, what we want is not "keep above" but rather "keep on the same layer as graphics window", which is already achieved by setting window type to "utility" on GNOME and Unity WMs, and by setting the transient window hint for the text window on KDE WM. --- src/gtk/gtkmain.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gtk/gtkmain.cpp b/src/gtk/gtkmain.cpp index bcd6cca6..ce25d357 100644 --- a/src/gtk/gtkmain.cpp +++ b/src/gtk/gtkmain.cpp @@ -718,7 +718,7 @@ private: bool _is_fullscreen; }; -GraphicsWindowGtk *GW = NULL; +std::unique_ptr GW; void GetGraphicsWindowSize(int *w, int *h) { Gdk::Rectangle allocation = GW->get_widget().get_allocation(); @@ -1315,7 +1315,6 @@ class TextWindowGtk : public Gtk::Window { public: TextWindowGtk() : _scrollbar(), _widget(_scrollbar.get_adjustment()), _overlay(_widget), _box() { - set_keep_above(true); set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); set_skip_taskbar_hint(true); set_skip_pager_hint(true); @@ -1393,7 +1392,7 @@ private: Gtk::HBox _box; }; -TextWindowGtk *TW = NULL; +std::unique_ptr TW; void ShowTextWindow(bool visible) { if(visible) @@ -1539,10 +1538,11 @@ int main(int argc, char** argv) { CnfLoad(); - TW = new TextWindowGtk; - GW = new GraphicsWindowGtk; + TW.reset(new TextWindowGtk); + GW.reset(new GraphicsWindowGtk); InitMainMenu(&GW->get_menubar()); GW->get_menubar().accelerate(*TW); + TW->set_transient_for(*GW); TW->show_all(); GW->show_all(); @@ -1561,8 +1561,8 @@ int main(int argc, char** argv) { main.run(*GW); - delete GW; - delete TW; + TW.reset(); + GW.reset(); SK.Clear(); SS.Clear();