X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ff654490b7cb185631a1dc4621094d88643ccf41..c114eb7a9fe8da830622db4e9be301e53734218d:/src/gtk/toplevel.cpp diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index acaec2299a..caca06176d 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -45,6 +45,11 @@ // XA_CARDINAL #include +#if wxUSE_LIBHILDON + #include + #include +#endif // wxUSE_LIBHILDON + // ---------------------------------------------------------------------------- // data // ---------------------------------------------------------------------------- @@ -366,13 +371,25 @@ gtk_frame_map_callback( GtkWidget* widget, win->m_width = rect.width; win->m_height = rect.height; decorSize = size; - wxSizeEvent event(win->GetSize(), win->GetId()); - event.SetEventObject(win); - win->GetEventHandler()->ProcessEvent(event); } } + const bool wasIconized = win->IsIconized(); + win->SetIconizeState(false); + + 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; } } @@ -430,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) @@ -492,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) { @@ -518,6 +542,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, style |= wxFRAME_NO_TASKBAR; } } +#endif // wxUSE_LIBHILDON/!wxUSE_LIBHILDON } wxWindow *topParent = wxGetTopLevelParent(m_parent); @@ -557,7 +582,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget ); // m_wxwindow is the client area - m_wxwindow = gtk_pizza_new_no_scroll(); + m_wxwindow = wxPizza::New(); gtk_widget_show( m_wxwindow ); gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow ); @@ -654,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")); @@ -829,10 +859,6 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si { wxCHECK_RET( m_widget, wxT("invalid frame") ); - // this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow - wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") ); - - // deal with the position first int old_x = m_x; int old_y = m_y; @@ -1105,8 +1131,7 @@ bool wxTopLevelWindowGTK::SetShape(const wxRegion& region) GdkWindow *window = NULL; if (m_wxwindow) { - window = GTK_PIZZA(m_wxwindow)->bin_window; - do_shape_combine_region(window, region); + do_shape_combine_region(m_wxwindow->window, region); } window = m_widget->window; return do_shape_combine_region(window, region);