[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara caolanm at redhat.com
Tue May 19 08:54:16 PDT 2015


 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   28 ++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 93571a90b3c2e61f3c6ab9c4c42a8ce4f7fd87b2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 19 16:53:32 2015 +0100

    gtk3: checkmarks slightly clipped on left side
    
    Change-Id: If10822b64e0a9a28c45fd8a1c0e9e44bdbfb054b

diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 6d9e39d..2a414dd 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -787,13 +787,14 @@ void GtkSalGraphics::PaintCheckOrRadio(GtkStyleContext *context,
                                        const Rectangle& rControlRectangle,
                                        ControlType nType)
 {
-    gint x, y, indicator_size;
+    gint indicator_size;
     gtk_style_context_get_style(mpCheckButtonStyle,
                                 "indicator-size", &indicator_size,
-                                NULL );
+                                NULL);
+
+    gint x = (rControlRectangle.GetWidth() - indicator_size) / 2;
+    gint y = (rControlRectangle.GetHeight() - indicator_size) / 2;
 
-    x = (rControlRectangle.GetWidth() - indicator_size) / 2;
-    y = (rControlRectangle.GetHeight() - indicator_size) / 2;
     if (nType == CTRL_CHECKBOX)
         gtk_render_check(context, cr, x, y, indicator_size, indicator_size);
     else if (nType == CTRL_RADIOBUTTON)
@@ -1222,16 +1223,27 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPar
     if(((nType == CTRL_CHECKBOX) || (nType == CTRL_RADIOBUTTON)) &&
        nPart == PART_ENTIRE_CONTROL)
     {
+        rNativeBoundingRegion = rControlRegion;
+
         gtk_style_context_get_style( mpCheckButtonStyle,
                                      "indicator-size", &indicator_size,
                                      "indicator-spacing", &indicator_spacing,
                                      (char *)NULL );
 
-        gint size = indicator_size + indicator_spacing*2;
+        GtkBorder border;
+        gtk_style_context_get_border(mpCheckButtonStyle, GTK_STATE_FLAG_NORMAL, &border);
+
+        GtkBorder padding;
+        gtk_style_context_get_padding(mpCheckButtonStyle, GTK_STATE_FLAG_NORMAL, &padding);
 
-        point = MAX(0, rControlRegion.GetHeight() - size);
-        aEditRect = Rectangle( Point( 0, point / 2),
-                               Size( size, size ) );
+
+        indicator_size += 2*indicator_spacing + border.left + padding.left + border.right + padding.right;
+        Rectangle aIndicatorRect( Point( 0,
+                                         (rControlRegion.GetHeight()-indicator_size)/2),
+                                  Size( indicator_size, indicator_size ) );
+        rNativeContentRegion = aIndicatorRect;
+
+        return true;
     }
     else if( nType == CTRL_MENU_POPUP)
     {


More information about the Libreoffice-commits mailing list