[gtk+] quartz: Fix up dnd code



commit a5a51e325d1fef163d9da4611432d0cefd112395
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 20 18:09:45 2016 -0400

    quartz: Fix up dnd code
    
    Copy changes to drag highlight drawing from gtkdnd.c to gtkdnd-quartz.c.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763808

 gtk/gtkdnd-quartz.c |   48 ++----------------------------------------------
 1 files changed, 2 insertions(+), 46 deletions(-)
---
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index df2dbff..7fe27b6 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -337,42 +337,6 @@ gtk_drag_get_source_widget (GdkDragContext *context)
   return info->source_widget;
 }
 
-/*************************************************************
- * gtk_drag_highlight_draw:
- *     Callback for expose_event for highlighted widgets.
- *   arguments:
- *     widget:
- *     event:
- *     data:
- *   results:
- *************************************************************/
-
-static gboolean
-gtk_drag_highlight_draw (GtkWidget *widget,
-                         cairo_t   *cr,
-                        gpointer   data)
-{
-  int width = gtk_widget_get_allocated_width (widget);
-  int height = gtk_widget_get_allocated_height (widget);
-  GtkStyleContext *context = gtk_widget_get_style_context (widget);
-
-  gtk_style_context_save (context);
-  gtk_style_context_add_class (context, GTK_STYLE_CLASS_DND);
-
-  gtk_render_frame (context, cr, 0, 0, width, height);
-
-  gtk_style_context_restore (context);
-
-  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;
-}
-
 /**
  * gtk_drag_highlight: (method)
  * @widget: a widget to highlight
@@ -382,11 +346,7 @@ gtk_drag_highlight (GtkWidget  *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  g_signal_connect_after (widget, "draw",
-                         G_CALLBACK (gtk_drag_highlight_draw),
-                         NULL);
-
-  gtk_widget_queue_draw (widget);
+  gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_DROP_ACTIVE, FALSE);
 }
 
 /**
@@ -398,11 +358,7 @@ gtk_drag_unhighlight (GtkWidget *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  g_signal_handlers_disconnect_by_func (widget,
-                                       gtk_drag_highlight_draw,
-                                       NULL);
-  
-  gtk_widget_queue_draw (widget);
+  gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_DROP_ACTIVE);
 }
 
 static NSWindow *


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