X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f0eda0e6ee3c289a932ef5fd224ea1d67bb086a..923608c3ac95e2c705fb0f49ab48fbe62fc871bd:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9f639a3586..abd0171fe1 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -78,8 +78,6 @@ #undef HAVE_XIM #endif -extern GtkContainerClass *pizza_parent_class; - //----------------------------------------------------------------------------- // documentation on internals //----------------------------------------------------------------------------- @@ -404,13 +402,9 @@ gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindowGTK *win ) { - if (gdk_event->count > 0) return FALSE; - - draw_frame( widget, win ); - - (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event); - - return TRUE; + if (gdk_event->count == 0) + draw_frame(widget, win); + return false; } } @@ -517,8 +511,6 @@ gtk_window_expose_callback( GtkWidget *widget, win->GtkSendPaintEvents(); // Let parent window draw window-less widgets - (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event); - return FALSE; } } @@ -2145,7 +2137,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), alloc->height ); #endif - GTK_PIZZA(win->m_wxwindow)->m_width = alloc->width; + GTK_PIZZA(win->m_wxwindow)->m_width = win->GetClientSize().x; win->m_oldClientWidth = client_width; win->m_oldClientHeight = client_height; @@ -2473,7 +2465,7 @@ bool wxWindowGTK::Create( wxWindow *parent, #ifndef __WXUNIVERSAL__ GtkPizza *pizza = GTK_PIZZA(m_wxwindow); - + if (HasFlag(wxRAISED_BORDER)) { gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_OUT ); @@ -2608,8 +2600,6 @@ void wxWindowGTK::PostCreation() { // these get reported to wxWidgets -> wxPaintEvent - gtk_pizza_set_external( GTK_PIZZA(m_wxwindow), TRUE ); - g_signal_connect (m_wxwindow, "expose_event", G_CALLBACK (gtk_window_expose_callback), this); @@ -2763,10 +2753,6 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") ); wxASSERT_MSG( (m_parent != NULL), wxT("wxWindowGTK::SetSize requires parent.\n") ); -/* - printf( "DoSetSize: name %s, x,y,w,h: %d,%d,%d,%d \n", GetName().c_str(), x,y,width,height ); -*/ - if (m_resizing) return; /* I don't like recursions */ m_resizing = true; @@ -3066,6 +3052,28 @@ void wxWindowGTK::DoGetPosition( int *x, int *y ) const dy = gtk_pizza_get_yoffset( pizza ); } + if (m_x == -1 && m_y == -1) + { + GdkWindow *source = (GdkWindow *) NULL; + if (m_wxwindow) + source = GTK_PIZZA(m_wxwindow)->bin_window; + else + source = m_widget->window; + + if (source) + { + int org_x = 0; + int org_y = 0; + gdk_window_get_origin( source, &org_x, &org_y ); + + if (GetParent()) + GetParent()->ScreenToClient(&org_x, &org_y); + + ((wxWindowGTK*) this)->m_x = org_x; + ((wxWindowGTK*) this)->m_y = org_y; + } + } + if (x) (*x) = m_x - dx; if (y) (*y) = m_y - dy; } @@ -3095,7 +3103,15 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const } } - if (x) *x += org_x; + + if (x) + { + if (GetLayoutDirection() == wxLayout_RightToLeft) + *x = (GetClientSize().x - *x) + org_x; + else + *x += org_x; + } + if (y) *y += org_y; } @@ -3124,7 +3140,13 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const } } - if (x) *x -= org_x; + if (x) + { + if (GetLayoutDirection() == wxLayout_RightToLeft) + *x = (GetClientSize().x - *x) - org_x; + else + *x -= org_x; + } if (y) *y -= org_y; } @@ -3740,6 +3762,8 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) 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 @@ -3747,8 +3771,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect ) p = NULL; } - p = NULL; - gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, p, TRUE ); } }