[gtk+] Allow defining an invisible resize area for GtkPaned's handle.



commit 75f90ee4245172f4522868d3780219d19e546d6f
Author: Victor Martinez <victor elementaryos org>
Date:   Fri Apr 11 20:50:48 2014 -0600

    Allow defining an invisible resize area for GtkPaned's handle.
    
    This should allow theme developers to use a very small width for
    the resize handle, but still let users easily move the handle by
    defining a wider resize area.
    
    The additional resize area follows the "margin" style property.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728073

 gtk/gtkpaned.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 2fe515a..6a0b6e5 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1277,24 +1277,30 @@ gtk_paned_size_allocate (GtkWidget     *widget,
 
       if (gtk_widget_get_realized (widget))
        {
+          GtkBorder margin;
+
+          gtk_style_context_get_margin (gtk_widget_get_style_context (widget),
+                                        gtk_widget_get_state_flags (widget),
+                                        &margin);
+
          if (gtk_widget_get_mapped (widget))
            gdk_window_show (priv->handle);
 
           if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
             {
               gdk_window_move_resize (priv->handle,
-                                      priv->handle_pos.x,
+                                      priv->handle_pos.x - margin.left,
                                       priv->handle_pos.y,
-                                      handle_size,
+                                      handle_size + margin.left + margin.right,
                                       priv->handle_pos.height);
             }
           else
             {
               gdk_window_move_resize (priv->handle,
                                       priv->handle_pos.x,
-                                      priv->handle_pos.y,
+                                      priv->handle_pos.y - margin.top,
                                       priv->handle_pos.width,
-                                      handle_size);
+                                      handle_size + margin.top + margin.bottom);
             }
        }
 
@@ -2842,4 +2848,4 @@ gtk_paned_get_handle_window (GtkPaned *paned)
   g_return_val_if_fail (GTK_IS_PANED (paned), NULL);
 
   return paned->priv->handle;
-}
+}
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]