X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/11d8dfd2fb6cf04c4695e0aed64288b931b86eb6..55410bb4f67febe1ca20654f078ea4fb9a6223ae:/src/gtk/toplevel.cpp diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index cf37ab6b71..5d04f3bcb3 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 @@ -434,7 +434,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,6 +442,7 @@ void wxTopLevelWindowGTK::Init() m_gdkFunc = 0; m_grabbed = false; m_deferShow = true; + m_deferShowAllowed = true; m_updateDecorSize = true; m_urgency_hint = -2; @@ -552,7 +553,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget ); // m_wxwindow is the client area - m_wxwindow = wxPizza::New(); + m_wxwindow = wxPizza::New(0,this); gtk_widget_show( m_wxwindow ); gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow ); @@ -665,7 +666,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)) @@ -780,7 +781,7 @@ bool wxTopLevelWindowGTK::Show( bool show ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - bool deferShow = show && !m_isShown && m_deferShow; + bool deferShow = show && !m_isShown && m_deferShow && m_deferShowAllowed; if (deferShow) { deferShow = false; @@ -896,6 +897,8 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si { wxCHECK_RET( m_widget, wxT("invalid frame") ); + m_deferShowAllowed = true; + // deal with the position first int old_x = m_x; int old_y = m_y; @@ -940,9 +943,9 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si void wxTopLevelWindowGTK::DoSetClientSize(int width, int height) { - if (m_deferShow && !m_isShown) - // Since client size is being explicitly set, don't change it later - m_deferShow = false; + // Since client size is being explicitly set, don't change it later + m_deferShowAllowed = false; + wxTopLevelWindowBase::DoSetClientSize(width, height); } @@ -1247,10 +1250,11 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags) bool new_hint_value = false; // FIXME: This is a workaround to focus handling problem - // If RequestUserAttention is called for example right after a wxSleep, OnInternalIdle hasn't - // yet been processed, and the internal focus system is not up to date yet. - // wxYieldIfNeeded ensures the processing of it, but can have unwanted side effects - MR - ::wxYieldIfNeeded(); + // If RequestUserAttention is called for example right after a wxSleep, OnInternalIdle + // hasn't yet been processed, and the internal focus system is not up to date yet. + // YieldFor(wxEVT_CATEGORY_UI) ensures the processing of it (hopefully it + // won't have side effects) - MR + wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI); if(m_urgency_hint >= 0) g_source_remove(m_urgency_hint);