[Libreoffice-commits] core.git: Branch 'libreoffice-5-1-1' - vcl/source vcl/unx

Michael Meeks michael.meeks at collabora.com
Mon Feb 29 23:18:15 UTC 2016


 vcl/source/control/spinfld.cxx            |    3 ++-
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |   29 ++++++++++++-----------------
 2 files changed, 14 insertions(+), 18 deletions(-)

New commits:
commit b994e8a2aae0807294a27f5136feca6c67baff7b
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Feb 15 15:56:23 2016 +0000

    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 at redhat.com>
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 5f86629..8f4bbca 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 a28938e..a4ef2d2 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


More information about the Libreoffice-commits mailing list