diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-02-15 15:56:23 +0000 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2016-02-29 23:17:55 +0000 |
commit | b994e8a2aae0807294a27f5136feca6c67baff7b (patch) | |
tree | fbc7d9945fdc66ca85db3f0faaf33d7dbdf3610b | |
parent | update credits (diff) | |
download | core-b994e8a2aae0807294a27f5136feca6c67baff7b.tar.gz core-b994e8a2aae0807294a27f5136feca6c67baff7b.zip |
tdf#97739 - ensure we have a valid rectangle for spin-button controls.
Otherwise OpenGL can't render, cache and diff these; so we loose them.
Also - fix gtk3 spinbuttons for recent control region changes
Conflicts:
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
Change-Id: Iac4f3ee0fc68154f708a881d5e0255fc9f8df62d
Reviewed-on: https://gerrit.libreoffice.org/22376
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | vcl/source/control/spinfld.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 29 |
2 files changed, 14 insertions, 18 deletions
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 5f86629d5d17..8f4bbca23bde 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -81,7 +81,8 @@ bool ImplDrawNativeSpinfield(vcl::RenderContext& rRenderContext, vcl::Window* pW rRenderContext.IsNativeControlSupported(CTRL_SPINBOX, rSpinbuttonValue.mnLowerPart)) { // only paint the embedded spin buttons, all buttons are painted at once - bNativeOK = rRenderContext.DrawNativeControl(CTRL_SPINBOX, PART_ALL_BUTTONS, Rectangle(), + Rectangle aUpperAndLowerButtons( rSpinbuttonValue.maUpperRect.GetUnion( rSpinbuttonValue.maLowerRect ) ); + bNativeOK = rRenderContext.DrawNativeControl(CTRL_SPINBOX, PART_ALL_BUTTONS, aUpperAndLowerButtons, ControlState::ENABLED, rSpinbuttonValue, OUString()); } else diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index a28938ed34c8..a4ef2d2a7ba7 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -621,10 +621,9 @@ 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; @@ -640,24 +639,20 @@ void 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(context, cr, nType, upBtnPart, areaRect, upBtnState ); - PaintOneSpinButton(context, cr, nType, downBtnPart, areaRect, downBtnState ); + cairo_translate(cr, -rControlRectangle.Left(), -rControlRectangle.Top()); + PaintOneSpinButton(context, cr, nType, upBtnPart, rControlRectangle, upBtnState ); + PaintOneSpinButton(context, cr, nType, downBtnPart, rControlRectangle, downBtnState ); + cairo_translate(cr, rControlRectangle.Left(), rControlRectangle.Top()); } #define ARROW_SIZE 11 * 0.85 |