X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e955eee585cc61b63f1d5be2938b015adef8fd55..1c1e6b5b5069167bae289e9f92ff0dd3db546b61:/src/gtk/toplevel.cpp diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 708f0bc2b7..4f3fbe689c 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -59,8 +59,8 @@ int wxOpenModalDialogsCount = 0; // the frame that is currently active (i.e. its child has focus). It is // used to generate wxActivateEvents -static wxTopLevelWindowGTK *g_activeFrame = (wxTopLevelWindowGTK*) NULL; -static wxTopLevelWindowGTK *g_lastActiveFrame = (wxTopLevelWindowGTK*) NULL; +static wxTopLevelWindowGTK *g_activeFrame = NULL; +static wxTopLevelWindowGTK *g_lastActiveFrame = NULL; // if we detect that the app has got/lost the focus, we set this variable to // either TRUE or FALSE and an activate event will be sent during the next @@ -222,9 +222,13 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win) if (!win->IsIconized()) { +#if 1 + win->m_resizeQueued = true; +#else wxSizeEvent event(size, win->GetId()); event.SetEventObject(win); win->HandleWindowEvent(event); +#endif } // else the window is currently unmapped, don't generate size events } @@ -434,7 +438,7 @@ static gboolean property_notify_event( void wxTopLevelWindowGTK::Init() { - m_mainWidget = (GtkWidget*) NULL; + m_mainWidget = NULL; m_isIconized = false; m_fsIsShowing = false; m_themeEnabled = true; @@ -442,8 +446,11 @@ void wxTopLevelWindowGTK::Init() m_gdkFunc = 0; m_grabbed = false; m_deferShow = true; + m_updateDecorSize = true; m_urgency_hint = -2; + + m_resizeQueued = false; } bool wxTopLevelWindowGTK::Create( wxWindow *parent, @@ -664,7 +671,7 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK() RemoveGrab(); } - m_isBeingDeleted = true; + SendDestroyEvent(); // it may also be GtkScrolledWindow in the case of an MDI child if (GTK_IS_WINDOW(m_widget)) @@ -779,18 +786,31 @@ bool wxTopLevelWindowGTK::Show( bool show ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - bool deferShow = show && m_deferShow && !m_isShown; + bool deferShow = show && !m_isShown && m_deferShow; if (deferShow) { - m_deferShow = - deferShow = !GTK_WIDGET_REALIZED(m_widget) && - gdk_x11_screen_supports_net_wm_hint( - gtk_widget_get_screen(m_widget), - gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false)) && + deferShow = false; + if (!GTK_WIDGET_REALIZED(m_widget) && g_signal_handler_find(m_widget, GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA), g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET), - 0, NULL, NULL, this); + 0, NULL, NULL, this)) + { + if (gdk_x11_screen_supports_net_wm_hint( + gtk_widget_get_screen(m_widget), + gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false))) + { + deferShow = true; + } + else + { + // Don't allow changes to m_decorSize, it breaks saving/restoring + // window size with GetSize()/SetSize() because it makes window + // bigger between each restore and save. + m_updateDecorSize = false; + } + } + m_deferShow = deferShow; } if (deferShow) { @@ -995,7 +1015,7 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const wxSize& decorSize) { if (!IsMaximized() && !IsFullScreen()) GetCachedDecorSize() = decorSize; - if (m_decorSize != decorSize) + if (m_updateDecorSize && m_decorSize != decorSize) { const wxSize diff = decorSize - m_decorSize; m_decorSize = decorSize; @@ -1075,6 +1095,15 @@ void wxTopLevelWindowGTK::OnInternalIdle() wxTheApp->SetActive(activate, (wxWindow *)g_lastActiveFrame); } + + if (m_resizeQueued) + { + wxSize size( m_width, m_height ); + wxSizeEvent event(size, GetId()); + event.SetEventObject(this); + HandleWindowEvent(event); + m_resizeQueued = false; + } } // ----------------------------------------------------------------------------