X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c7620f666a5a8cfd6a570c949d2e9ba109858a5..4a40cd9bae5e4e76fadb6188b399905028a02bc7:/src/gtk/toplevel.cpp diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 81c5430f1e..18d5775a2f 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -339,7 +339,6 @@ gtk_frame_map_callback( GtkWidget*, wxTopLevelWindow *win ) { const bool wasIconized = win->IsIconized(); - win->SetIconizeState(false); if (wasIconized) { // Because GetClientSize() returns (0,0) when IsIconized() is true, @@ -372,16 +371,18 @@ gtk_frame_map_callback( GtkWidget*, } //----------------------------------------------------------------------------- -// "unmap_event" from m_widget +// "window-state-event" from m_widget //----------------------------------------------------------------------------- extern "C" { static gboolean -gtk_frame_unmap_callback( GtkWidget * WXUNUSED(widget), - GdkEvent * WXUNUSED(event), +gtk_frame_window_state_callback( GtkWidget* WXUNUSED(widget), + GdkEventWindowState *event, wxTopLevelWindow *win ) { - win->SetIconizeState(true); + if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) + win->SetIconizeState((event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) != 0); + return false; } } @@ -592,11 +593,14 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, g_signal_connect (m_widget, "realize", G_CALLBACK (gtk_frame_realized_callback), this); - // map and unmap for iconized state + // for some reported size corrections g_signal_connect (m_widget, "map_event", G_CALLBACK (gtk_frame_map_callback), this); - g_signal_connect (m_widget, "unmap_event", - G_CALLBACK (gtk_frame_unmap_callback), this); + + // for iconized state + g_signal_connect (m_widget, "window_state_event", + G_CALLBACK (gtk_frame_window_state_callback), this); + // for wxMoveEvent g_signal_connect (m_widget, "configure_event", @@ -1012,17 +1016,6 @@ void wxTopLevelWindowGTK::DoSetClientSize(int width, int height) m_deferShowAllowed = false; } -wxSize wxTopLevelWindowGTK::DoGetBestSize() const -{ - // temporarily turn off m_isIconized, - // so we get an accurate client size from DoGetClientSize - const bool save = m_isIconized; - const_cast(this)->m_isIconized = false; - const wxSize size = base_type::DoGetBestSize(); - const_cast(this)->m_isIconized = save; - return size; -} - void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const { wxASSERT_MSG(m_widget, wxT("invalid frame"));