[gtk+/rendering-cleanup-next: 105/153] dnd-quartz: Connect to draw func for dnd hilight



commit 91c955122a466f23a8e4481ce05fb8fff0ea67dc
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 8 21:24:01 2010 +0200

    dnd-quartz: Connect to draw func for dnd hilight

 gtk/gtkdnd-quartz.c |   63 +++++++++++++++++----------------------------------
 1 files changed, 21 insertions(+), 42 deletions(-)
---
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index f091857..b12a70d 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -335,7 +335,7 @@ gtk_drag_get_source_widget (GdkDragContext *context)
 }
 
 /*************************************************************
- * gtk_drag_highlight_expose:
+ * gtk_drag_highlight_draw:
  *     Callback for expose_event for highlighted widgets.
  *   arguments:
  *     widget:
@@ -345,45 +345,24 @@ gtk_drag_get_source_widget (GdkDragContext *context)
  *************************************************************/
 
 static gboolean
-gtk_drag_highlight_expose (GtkWidget      *widget,
-			   GdkEventExpose *event,
-			   gpointer        data)
-{
-  gint x, y, width, height;
-  
-  if (gtk_widget_is_drawable (widget))
-    {
-      cairo_t *cr;
-      
-      if (!gtk_widget_get_has_window (widget))
-	{
-	  x = widget->allocation.x;
-	  y = widget->allocation.y;
-	  width = widget->allocation.width;
-	  height = widget->allocation.height;
-	}
-      else
-	{
-	  x = 0;
-	  y = 0;
-	  gdk_drawable_get_size (widget->window, &width, &height);
-	}
-      
-      gtk_paint_shadow (widget->style, widget->window,
-		        GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-		        NULL, widget, "dnd",
-			x, y, width, height);
-
-      cr = gdk_cairo_create (widget->window);
-      cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
-      cairo_set_line_width (cr, 1.0);
-      cairo_rectangle (cr,
-		       x + 0.5, y + 0.5,
-		       width - 1, height - 1);
-      cairo_stroke (cr);
-      cairo_destroy (cr);
-    }
-
+gtk_drag_highlight_draw (GtkWidget *widget,
+                         cairo_t   *cr,
+                         int        width,
+                         int        height,
+			 gpointer   data)
+{
+  gtk_cairo_paint_shadow (gtk_widget_get_style (widget), cr,
+                    GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+                    widget, "dnd",
+                    0, 0, width, height);
+
+  cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
+  cairo_set_line_width (cr, 1.0);
+  cairo_rectangle (cr,
+                   0.5, 0.5,
+                   width - 1, height - 1);
+  cairo_stroke (cr);
+ 
   return FALSE;
 }
 
@@ -400,8 +379,8 @@ gtk_drag_highlight (GtkWidget  *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  g_signal_connect_after (widget, "expose-event",
-			  G_CALLBACK (gtk_drag_highlight_expose),
+  g_signal_connect_after (widget, "draw",
+			  G_CALLBACK (gtk_drag_highlight_draw),
 			  NULL);
 
   gtk_widget_queue_draw (widget);
@@ -421,7 +400,7 @@ gtk_drag_unhighlight (GtkWidget *widget)
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   g_signal_handlers_disconnect_by_func (widget,
-					gtk_drag_highlight_expose,
+					gtk_drag_highlight_draw,
 					NULL);
   
   gtk_widget_queue_draw (widget);



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