]> git.saurik.com Git - wxWidgets.git/commitdiff
create wxDialog with proper _NET_WM hint so that the WMs recognize it as a dialog
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 28 Jun 2004 21:37:33 +0000 (21:37 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 28 Jun 2004 21:37:33 +0000 (21:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/toplevel.cpp
src/gtk1/toplevel.cpp

index b91b944750fc2eb70e8e13aa2e8749b8129c6714..62cf1e50b705a707b163d124a5584b46239e17c9 100644 (file)
@@ -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)) &&
index b91b944750fc2eb70e8e13aa2e8749b8129c6714..62cf1e50b705a707b163d124a5584b46239e17c9 100644 (file)
@@ -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)) &&