X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6cab4fcac7fe26d9ae5a1d29066e0893d689bb38..78612fa68fdeb01b2cb0fa8b2b89fc8924bb71ff:/src/gtk/window.cpp?ds=sidebyside diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 6f2da8ab52..1f64d565bd 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3545,6 +3545,9 @@ void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground), else return; + if (!widget->window) + return; + if (rect == NULL) gtk_widget_queue_draw(widget); else @@ -3553,7 +3556,16 @@ void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground), if (GetLayoutDirection() == wxLayout_RightToLeft) x = GetClientSize().x - x - rect->width; +#if 0 gtk_widget_queue_draw_area(widget, x, rect->y, rect->width, rect->height); +#else + GdkRectangle r; + r.x = rect->x; + r.y = rect->y; + r.width = rect->width; + r.height = rect->height; + gdk_window_invalidate_rect( m_wxwindow->window, &r, TRUE ); +#endif } } @@ -4183,7 +4195,7 @@ int wxWindowGTK::GetScrollThumb(int orient) const GtkRange * const sb = m_scrollBar[ScrollDirFromOrient(orient)]; wxCHECK_MSG( sb, 0, _T("this window is not scrollable") ); - return int(sb->adjustment->page_size); + return wxRound(sb->adjustment->page_size); } int wxWindowGTK::GetScrollPos( int orient ) const @@ -4191,7 +4203,7 @@ int wxWindowGTK::GetScrollPos( int orient ) const GtkRange * const sb = m_scrollBar[ScrollDirFromOrient(orient)]; wxCHECK_MSG( sb, 0, _T("this window is not scrollable") ); - return int(sb->adjustment->value + 0.5); + return wxRound(sb->adjustment->value); } int wxWindowGTK::GetScrollRange( int orient ) const @@ -4199,7 +4211,7 @@ int wxWindowGTK::GetScrollRange( int orient ) const GtkRange * const sb = m_scrollBar[ScrollDirFromOrient(orient)]; wxCHECK_MSG( sb, 0, _T("this window is not scrollable") ); - return int(sb->adjustment->upper); + return wxRound(sb->adjustment->upper); } // Determine if increment is the same as +/-x, allowing for some small @@ -4218,14 +4230,14 @@ wxEventType wxWindowGTK::GetScrollEventType(GtkRange* range) const int barIndex = range == m_scrollBar[1]; GtkAdjustment* adj = range->adjustment; - const int value = int(adj->value + 0.5); + const int value = wxRound(adj->value); // save previous position const double oldPos = m_scrollPos[barIndex]; // update current position m_scrollPos[barIndex] = adj->value; // If event should be ignored, or integral position has not changed - if (!m_hasVMT || g_blockEventsOnDrag || value == int(oldPos + 0.5)) + if (!m_hasVMT || g_blockEventsOnDrag || value == wxRound(oldPos)) { return wxEVT_NULL; }