X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd8445da0f0e4176d28a9d84c96798333e040392..654c223bc7c5457e407ff7d127a8129c821b07e4:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 0b4bb5f0e4..6f2da8ab52 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -257,11 +257,11 @@ gdk_window_warp_pointer (GdkWindow *window, // "size_request" of m_widget //----------------------------------------------------------------------------- -// make it extern because wxStaticText needs to disconnect this one extern "C" { -void wxgtk_window_size_request_callback(GtkWidget * WXUNUSED(widget), - GtkRequisition *requisition, - wxWindow * win) +static void +wxgtk_window_size_request_callback(GtkWidget * WXUNUSED(widget), + GtkRequisition *requisition, + wxWindow * win) { int w, h; win->GetSize( &w, &h ); @@ -2095,6 +2095,7 @@ bool wxWindowGTK::Create( wxWindow *parent, { // Get default border wxBorder border = GetBorder(style); + style &= ~wxBORDER_MASK; style |= border; @@ -2105,8 +2106,14 @@ bool wxWindowGTK::Create( wxWindow *parent, return false; } + // We should accept the native look +#if 0 + GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) ); + scroll_class->scrollbar_spacing = 0; +#endif - m_wxwindow = wxPizza::New(m_windowStyle); + + m_wxwindow = wxPizza::New(m_windowStyle,this); #ifndef __WXUNIVERSAL__ if (HasFlag(wxPizza::BORDER_STYLES)) { @@ -2122,12 +2129,6 @@ bool wxWindowGTK::Create( wxWindow *parent, GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); - // We should accept the native look -#if 0 - GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) ); - scroll_class->scrollbar_spacing = 0; -#endif - // There is a conflict with default bindings at GTK+ // level between scrolled windows and notebooks both of which want to use // Ctrl-PageUp/Down: scrolled windows for scrolling in the horizontal @@ -2539,6 +2540,12 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags event.SetEventObject( this ); HandleWindowEvent( event ); } + } else + if (sizeFlags & wxSIZE_FORCE_EVENT) + { + wxSizeEvent event( wxSize(m_width,m_height), GetId() ); + event.SetEventObject( this ); + HandleWindowEvent( event ); } } @@ -2680,12 +2687,15 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const continue; } + GtkScrolledWindowClass *scroll_class = + GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) ); + GtkRequisition req; gtk_widget_size_request(GTK_WIDGET(range), &req); if (i == ScrollDir_Horz) - h -= req.height; + h -= req.height + scroll_class->scrollbar_spacing; else - w -= req.width; + w -= req.width + scroll_class->scrollbar_spacing; } } @@ -3527,63 +3537,39 @@ bool wxWindowGTK::ScrollPages(int pages) void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground), const wxRect *rect) { - if (!m_widget) - return; - if (!m_widget->window) + GtkWidget* widget; + if (m_wxwindow) + widget = m_wxwindow; + else if (m_widget) + widget = m_widget; + else return; - if (m_wxwindow) + if (rect == NULL) + gtk_widget_queue_draw(widget); + else { - if (m_wxwindow->window == NULL) return; - - GdkRectangle gdk_rect, - *p; - if (rect) - { - gdk_rect.x = rect->x; - gdk_rect.y = rect->y; - gdk_rect.width = rect->width; - gdk_rect.height = rect->height; - if (GetLayoutDirection() == wxLayout_RightToLeft) - gdk_rect.x = GetClientSize().x - gdk_rect.x - gdk_rect.width; - - p = &gdk_rect; - } - else // invalidate everything - { - p = NULL; - } + int x = rect->x; + if (GetLayoutDirection() == wxLayout_RightToLeft) + x = GetClientSize().x - x - rect->width; - gdk_window_invalidate_rect(m_wxwindow->window, p, true); + gtk_widget_queue_draw_area(widget, x, rect->y, rect->width, rect->height); } } void wxWindowGTK::Update() { - GtkUpdate(); - - // when we call Update() we really want to update the window immediately on - // screen, even if it means flushing the entire queue and hence slowing down - // everything -- but it should still be done, it's just that Update() should - // be called very rarely - gdk_flush(); -} + if (m_widget && m_widget->window) + { + GdkDisplay* display = gtk_widget_get_display(m_widget); + // Flush everything out to the server, and wait for it to finish. + // This ensures nothing will overwrite the drawing we are about to do. + gdk_display_sync(display); -void wxWindowGTK::GtkUpdate() -{ - if (m_wxwindow && m_wxwindow->window) - gdk_window_process_updates(m_wxwindow->window, false); - if (m_widget && m_widget->window && (m_wxwindow != m_widget)) - gdk_window_process_updates( m_widget->window, FALSE ); + gdk_window_process_updates(m_widget->window, true); - // for consistency with other platforms (and also because it's convenient - // to be able to update an entire TLW by calling Update() only once), we - // should also update all our children here - for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - node->GetData()->GtkUpdate(); + // Flush again, but no need to wait for it to finish + gdk_display_flush(display); } } @@ -3592,7 +3578,6 @@ bool wxWindowGTK::DoIsExposed( int x, int y ) const return m_updateRegion.Contains(x, y) != wxOutRegion; } - bool wxWindowGTK::DoIsExposed( int x, int y, int w, int h ) const { if (GetLayoutDirection() == wxLayout_RightToLeft)