From 4d8d6490dac1d447196b111ea009b23d4fce9e67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Mon, 28 Jun 2004 21:37:33 +0000 Subject: [PATCH] create wxDialog with proper _NET_WM hint so that the WMs recognize it as a dialog git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/toplevel.cpp | 18 ++++++++++++------ src/gtk1/toplevel.cpp | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index b91b944750..62cf1e50b7 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -350,21 +350,27 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, if (m_widget == NULL) { GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; - if (style & wxFRAME_TOOL_WINDOW) win_type = GTK_WINDOW_POPUP; if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) { - // there is no more GTK_WINDOW_DIALOG in 2.0 #ifdef __WXGTK20__ - win_type = GTK_WINDOW_TOPLEVEL; + m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); + // Tell WM that this is a dialog window and make it center + // on parent by default (this is what GtkDialog ctor does): + gtk_window_set_type_hint(GTK_WINDOW(m_widget), + GDK_WINDOW_TYPE_HINT_DIALOG); + gtk_window_set_position(GTK_WINDOW(m_widget), + GTK_WIN_POS_CENTER_ON_PARENT); #else - win_type = GTK_WINDOW_DIALOG; + m_widget = gtk_window_new(GTK_WINDOW_DIALOG); #endif } - - m_widget = gtk_window_new( win_type ); + else + { + m_widget = gtk_window_new(win_type); + } } if (m_parent && (((GTK_IS_WINDOW(m_parent->m_widget)) && diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index b91b944750..62cf1e50b7 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -350,21 +350,27 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, if (m_widget == NULL) { GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; - if (style & wxFRAME_TOOL_WINDOW) win_type = GTK_WINDOW_POPUP; if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) { - // there is no more GTK_WINDOW_DIALOG in 2.0 #ifdef __WXGTK20__ - win_type = GTK_WINDOW_TOPLEVEL; + m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); + // Tell WM that this is a dialog window and make it center + // on parent by default (this is what GtkDialog ctor does): + gtk_window_set_type_hint(GTK_WINDOW(m_widget), + GDK_WINDOW_TYPE_HINT_DIALOG); + gtk_window_set_position(GTK_WINDOW(m_widget), + GTK_WIN_POS_CENTER_ON_PARENT); #else - win_type = GTK_WINDOW_DIALOG; + m_widget = gtk_window_new(GTK_WINDOW_DIALOG); #endif } - - m_widget = gtk_window_new( win_type ); + else + { + m_widget = gtk_window_new(win_type); + } } if (m_parent && (((GTK_IS_WINDOW(m_parent->m_widget)) && -- 2.45.2