X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22c9b21132f0497c71069c06f82113b77aa47bca..b4ea182b39cf538d2ff2885b7b7406a221f44c3d:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9d92740270..d94f9f2b0a 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1152,43 +1152,6 @@ gtk_window_key_press_callback( GtkWidget *widget, ret = win->GetParent()->GetEventHandler()->ProcessEvent( new_event ); } - // generate wxID_CANCEL if has been pressed (typically in dialogs) - if ( !ret && - (gdk_event->keyval == GDK_Escape) ) - { - // however only do it if we have a Cancel button in the dialog, - // otherwise the user code may get confused by the events from a - // nonexistent button and, worse, a wxButton might get button event - // from another button which is not really expected - wxWindow *winForCancel = win, - *btnCancel = NULL; - while ( winForCancel ) - { - btnCancel = winForCancel->FindWindow(wxID_CANCEL); - if ( btnCancel ) - { - // found a cancel button - break; - } - - if ( winForCancel->IsTopLevel() ) - { - // no need to look further - break; - } - - // maybe our parent has a cancel button? - winForCancel = winForCancel->GetParent(); - } - - if ( btnCancel ) - { - wxCommandEvent eventClick(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); - eventClick.SetEventObject(btnCancel); - ret = btnCancel->GetEventHandler()->ProcessEvent(eventClick); - } - } - if (ret) { g_signal_stop_emission_by_name (widget, "key_press_event"); @@ -2494,6 +2457,8 @@ void wxWindowGTK::Init() m_hasVMT = false; m_needParent = true; m_isBeingDeleted = false; + + m_showOnIdle= false; m_noExpose = false; m_nativeSizeEvent = false; @@ -2994,8 +2959,32 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags m_resizing = false; } +bool wxWindowGTK::GtkShowFromOnIdle() +{ + if (IsShown() && m_showOnIdle && !GTK_WIDGET_VISIBLE (m_widget)) + { + GtkAllocation alloc; + alloc.x = m_x; + alloc.y = m_y; + alloc.width = m_width; + alloc.height = m_height; + gtk_widget_size_allocate( m_widget, &alloc ); + gtk_widget_show( m_widget ); + wxShowEvent eventShow(GetId(), true); + eventShow.SetEventObject(this); + GetEventHandler()->ProcessEvent(eventShow); + m_showOnIdle = false; + return true; + } + + return false; +} + void wxWindowGTK::OnInternalIdle() { + // Check if we have to show window now + if (GtkShowFromOnIdle()) return; + if ( m_dirtyTabOrder ) { m_dirtyTabOrder = false; @@ -3009,7 +2998,7 @@ void wxWindowGTK::OnInternalIdle() SetBackgroundStyle(GetBackgroundStyle()); m_needsStyleChange = false; } - + // Update invalidated regions. GtkUpdate(); @@ -3219,14 +3208,22 @@ bool wxWindowGTK::Show( bool show ) } if (show) - gtk_widget_show( m_widget ); + { + if (!m_showOnIdle) + { + gtk_widget_show( m_widget ); + wxShowEvent eventShow(GetId(), show); + eventShow.SetEventObject(this); + GetEventHandler()->ProcessEvent(eventShow); + } + } else + { gtk_widget_hide( m_widget ); - - wxShowEvent eventShow(GetId(), show); - eventShow.SetEventObject(this); - - GetEventHandler()->ProcessEvent(eventShow); + wxShowEvent eventShow(GetId(), show); + eventShow.SetEventObject(this); + GetEventHandler()->ProcessEvent(eventShow); + } return true; } @@ -3464,6 +3461,12 @@ bool wxWindowGTK::Reparent( wxWindowBase *newParentBase ) if (newParent) { + if (GTK_WIDGET_VISIBLE (newParent->m_widget)) + { + m_showOnIdle = true; + gtk_widget_hide( m_widget ); + } + /* insert GTK representation */ (*(newParent->m_insertCallback))(newParent, this); } @@ -3698,6 +3701,8 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) if (m_wxwindow) { + if (!GTK_PIZZA(m_wxwindow)->bin_window) return; + GdkRectangle gdk_rect, *p; if (rect)