X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d7ce4338972dc2eb6d50bb93d178023658d9add4..3aaaf1aaa0dfe514bd778bc11dfa96854952c246:/src/gtk/toplevel.cpp diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 4f3fbe689c..5400a73d6a 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -222,13 +222,9 @@ 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 } @@ -446,11 +442,10 @@ void wxTopLevelWindowGTK::Init() m_gdkFunc = 0; m_grabbed = false; m_deferShow = true; + m_deferShowAllowed = true; m_updateDecorSize = true; m_urgency_hint = -2; - - m_resizeQueued = false; } bool wxTopLevelWindowGTK::Create( wxWindow *parent, @@ -558,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 ); @@ -782,11 +777,21 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long) // overridden wxWindow methods // ---------------------------------------------------------------------------- +void wxTopLevelWindowGTK::Refresh( bool WXUNUSED(eraseBackground), const wxRect *WXUNUSED(rect) ) +{ + wxCHECK_RET( m_widget, wxT("invalid frame") ); + + gtk_widget_queue_draw( m_widget ); + + if (m_wxwindow && m_wxwindow->window) + gdk_window_invalidate_rect( m_wxwindow->window, NULL, TRUE ); +} + 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; @@ -902,6 +907,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; @@ -946,9 +953,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); } @@ -1095,15 +1102,6 @@ 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; - } } // ---------------------------------------------------------------------------- @@ -1262,10 +1260,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);