diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-02-16 12:27:29 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-02-16 12:28:47 +0000 |
commit | e6d255420a7fb00ed1050e0e96768eea57a92bc4 (patch) | |
tree | 17fbf72496199243612692b1f572d30fcddad5cb | |
parent | 7cdb46536db710d1173f410d02f3c49674939db8 (diff) |
Related: tdf#97739 fix gtk3 spinbuttons for recent control region changes
Change-Id: Ia745cbe808395c4c9ec6a3c72612814a4834bbcb
-rw-r--r-- | vcl/inc/unx/gtk/gtkgdi.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 35 |
2 files changed, 15 insertions, 22 deletions
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx index 2bb602982598..d4ae5f06af3a 100644 --- a/vcl/inc/unx/gtk/gtkgdi.hxx +++ b/vcl/inc/unx/gtk/gtkgdi.hxx @@ -163,7 +163,7 @@ private: ControlPart nPart, Rectangle aAreaRect, ControlState nState ); - Rectangle PaintSpinButton(GtkStyleContext *context, + void PaintSpinButton(GtkStyleContext *context, cairo_t *cr, const Rectangle& rControlRectangle, ControlType nType, diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 8cdb67be98b4..df3f5c6f9b31 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -607,14 +607,13 @@ void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context, g_object_unref(pixbuf); } -Rectangle GtkSalGraphics::PaintSpinButton(GtkStyleContext *context, +void GtkSalGraphics::PaintSpinButton(GtkStyleContext *context, cairo_t *cr, const Rectangle& rControlRectangle, ControlType nType, - ControlPart /*nPart*/, + ControlPart nPart, const ImplControlValue& rValue ) { - Rectangle areaRect; const SpinbuttonValue *pSpinVal = (rValue.getType() == CTRL_SPINBUTTONS) ? static_cast<const SpinbuttonValue *>(&rValue) : nullptr; ControlPart upBtnPart = PART_BUTTON_UP; ControlState upBtnState = ControlState::NONE; @@ -630,26 +629,20 @@ Rectangle GtkSalGraphics::PaintSpinButton(GtkStyleContext *context, downBtnState = pSpinVal->mnLowerState; } - areaRect = rControlRectangle; - - gtk_render_background(context, cr, - 0, 0, - areaRect.GetWidth(), areaRect.GetHeight() ); - gtk_render_frame(context, cr, - 0, 0, - areaRect.GetWidth(), areaRect.GetHeight() ); - - // CTRL_SPINBUTTONS pass their area in pSpinVal, not in rControlRectangle - if (pSpinVal) + if (nPart == PART_ENTIRE_CONTROL) { - areaRect = pSpinVal->maUpperRect; - areaRect.Union( pSpinVal->maLowerRect ); + gtk_render_background(context, cr, + 0, 0, + rControlRectangle.GetWidth(), rControlRectangle.GetHeight() ); + gtk_render_frame(context, cr, + 0, 0, + rControlRectangle.GetWidth(), rControlRectangle.GetHeight() ); } - PaintOneSpinButton(mpSpinUpStyle, cr, nType, upBtnPart, areaRect, upBtnState ); - PaintOneSpinButton(mpSpinDownStyle, cr, nType, downBtnPart, areaRect, downBtnState ); - - return areaRect; + cairo_translate(cr, -rControlRectangle.Left(), -rControlRectangle.Top()); + PaintOneSpinButton(mpSpinUpStyle, cr, nType, upBtnPart, rControlRectangle, upBtnState ); + PaintOneSpinButton(mpSpinDownStyle, cr, nType, downBtnPart, rControlRectangle, downBtnState ); + cairo_translate(cr, rControlRectangle.Left(), rControlRectangle.Top()); } #define ARROW_SIZE 11 * 0.85 @@ -1478,7 +1471,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co PaintScrollbar(context, cr, rControlRegion, nType, nPart, rValue); break; case RENDER_SPINBUTTON: - aDamageRect.Union(PaintSpinButton(context, cr, rControlRegion, nType, nPart, rValue)); + PaintSpinButton(context, cr, rControlRegion, nType, nPart, rValue); break; case RENDER_COMBOBOX: PaintCombobox(flags, cr, rControlRegion, nType, nPart, rValue); |