[gdl] Fix drawing with latest gtk+



commit c582cda4aea01cad352d420cf69715d5ad85e5db
Author: Johannes Schmid <jhs gnome org>
Date:   Fri Dec 10 10:52:39 2010 +0100

    Fix drawing with latest gtk+
    
    Somehow we need to force drawing the background for the item-grip, it doesn't default to the usual background anymore

 gdl/gdl-dock-item-grip.c |   24 +++++++++++++++++++++++-
 gdl/gdl-dock-tablabel.c  |    4 ++++
 2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/gdl/gdl-dock-item-grip.c b/gdl/gdl-dock-item-grip.c
index 72b1bdd..2acc55a 100644
--- a/gdl/gdl-dock-item-grip.c
+++ b/gdl/gdl-dock-item-grip.c
@@ -105,14 +105,31 @@ gdl_dock_item_grip_draw (GtkWidget      *widget,
                          cairo_t *cr)
 {
     GdlDockItemGrip *grip;
-    GtkAllocation allocation;
     cairo_rectangle_int_t handle_area;
     cairo_rectangle_int_t expose_area;
 
+    gint width = gtk_widget_get_allocated_width (widget);
+    gint height = gtk_widget_get_allocated_height (widget);
+
     grip = GDL_DOCK_ITEM_GRIP (widget);
 
     if (grip->_priv->handle_shown) 
     {
+        GtkAllocation allocation;
+        gtk_widget_get_allocation (widget, &allocation);
+        if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL) {
+            handle_area.x = allocation.x;
+            handle_area.y = allocation.y;
+            handle_area.width = DRAG_HANDLE_SIZE;
+            handle_area.height = allocation.height;
+        } else {
+            handle_area.x = allocation.x + allocation.width
+                - DRAG_HANDLE_SIZE;
+            handle_area.y = allocation.y;
+            handle_area.width = DRAG_HANDLE_SIZE;
+            handle_area.height = allocation.height;
+        }
+        
         if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
         {                               
             gtk_render_handle (gtk_widget_get_style_context (widget),
@@ -124,6 +141,11 @@ gdl_dock_item_grip_draw (GtkWidget      *widget,
         
     }
 
+    gtk_render_background (gtk_widget_get_style_context (widget),
+                           cr,
+                           0, 0,
+                           width, height);
+
     return GTK_WIDGET_CLASS (gdl_dock_item_grip_parent_class)->draw (widget, cr);
 }
 
diff --git a/gdl/gdl-dock-tablabel.c b/gdl/gdl-dock-tablabel.c
index ffdb78c..b7dbd1a 100644
--- a/gdl/gdl-dock-tablabel.c
+++ b/gdl/gdl-dock-tablabel.c
@@ -401,6 +401,10 @@ gdl_dock_tablabel_paint (GtkWidget      *widget,
     
     if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
     {
+        GtkStyleContext* context = gtk_widget_get_style_context (widget);
+        gtk_style_context_set_state (context,
+                                     tablabel->active ? 0 : GTK_STATE_FLAG_ACTIVE);
+        
         gtk_render_handle (gtk_widget_get_style_context (widget),
                            cr, rect.x, rect.y, rect.width, rect.height);                           
     };



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