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

Caolán McNamara caolanm at redhat.com
Tue Feb 16 13:15:00 UTC 2016


 vcl/inc/unx/gtk/gtkgdi.hxx                |    2 -
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |   35 ++++++++++++------------------
 2 files changed, 15 insertions(+), 22 deletions(-)

New commits:
commit e84f75d538772ecb297fe07d241d78894a98bd49
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 16 12:27:29 2016 +0000

    Related: tdf#97739 fix gtk3 spinbuttons for recent control region changes
    
    Change-Id: Ia745cbe808395c4c9ec6a3c72612814a4834bbcb
    (cherry picked from commit e6d255420a7fb00ed1050e0e96768eea57a92bc4)
    Reviewed-on: https://gerrit.libreoffice.org/22395
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 2bb6029..d4ae5f0 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 5205d13..20efd8a 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -610,14 +610,13 @@ void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context,
     gtk_icon_info_free(info);
 }
 
-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;
@@ -633,26 +632,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
@@ -1481,7 +1474,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);


More information about the Libreoffice-commits mailing list