]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/toplevel.cpp
Getting borders working
[wxWidgets.git] / src / gtk / toplevel.cpp
index 462ec86004d5d72d7ad5c45912b09ee6e1f19863..caca06176dced148fc4132634456fc1e23408b20 100644 (file)
 // XA_CARDINAL
 #include <X11/Xatom.h>
 
+#if wxUSE_LIBHILDON
+    #include <hildon-widgets/hildon-program.h>
+    #include <hildon-widgets/hildon-window.h>
+#endif // wxUSE_LIBHILDON
+
 // ----------------------------------------------------------------------------
 // data
 // ----------------------------------------------------------------------------
@@ -369,16 +374,21 @@ gtk_frame_map_callback( GtkWidget* widget,
         }
     }
 
+    const bool wasIconized = win->IsIconized();
+
     win->SetIconizeState(false);
 
-    // Because GetClientSize() returns (0,0) when IsIconized() is true,
-    // a size event must be sent here, just in case GetClientSize() was
-    // called while iconized.
-    // This specifically happens when restoring a tlw that was "rolled up"
-    // with some WMs.
-    wxSizeEvent event(win->GetSize(), win->GetId());
-    event.SetEventObject(win);
-    win->GetEventHandler()->ProcessEvent(event);
+    if (wasIconized)
+    {
+        // Because GetClientSize() returns (0,0) when IsIconized() is true,
+        // a size event must be generated, just in case GetClientSize() was
+        // called while iconized. This specifically happens when restoring a
+        // tlw that was "rolled up" with some WMs.
+        // Queue a resize rather than sending size event directly to allow
+        // children to be made visible first.
+        win->m_oldClientWidth = 0;
+        gtk_widget_queue_resize(win->m_wxwindow);
+    }
 
     return false;
 }
@@ -437,9 +447,8 @@ static gboolean property_notify_event(
                 if (win->m_width  < 0) win->m_width  = 0;
                 if (win->m_height < 0) win->m_height = 0;
                 decorSize = size;
-                wxSizeEvent event(win->GetSize(), win->GetId());
-                event.SetEventObject(win);
-                win->GetEventHandler()->ProcessEvent(event);
+                win->m_oldClientWidth = 0;
+                gtk_widget_queue_resize(win->m_wxwindow);
             }
         }
         if (data)
@@ -499,6 +508,14 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
     //     e.g. in wxTaskBarIconAreaGTK
     if (m_widget == NULL)
     {
+#if wxUSE_LIBHILDON
+        // we must create HildonWindow and not a normal GtkWindow as the latter
+        // doesn't look correctly in Maemo environment and it must also be
+        // registered with the main program object
+        m_widget = hildon_window_new();
+        hildon_program_add_window(wxTheApp->GetHildonProgram(),
+                                  HILDON_WINDOW(m_widget));
+#else // !wxUSE_LIBHILDON
         m_widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
         if (GetExtraStyle() & wxTOPLEVEL_EX_DIALOG)
         {
@@ -525,6 +542,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
                 style |= wxFRAME_NO_TASKBAR;
             }
         }
+#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON
     }
 
     wxWindow *topParent = wxGetTopLevelParent(m_parent);
@@ -661,6 +679,11 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
 
 wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
 {
+#if wxUSE_LIBHILDON
+    hildon_program_remove_window(wxTheApp->GetHildonProgram(),
+                                 HILDON_WINDOW(m_widget));
+#endif // wxUSE_LIBHILDON
+
     if (m_grabbed)
     {
         wxFAIL_MSG(_T("Window still grabbed"));