[gtk+/xi2: 136/148] GtkWidget: Respect multidevice awareness when changing widget state.



commit f77eb4fb3c98dc59e3ab573803150d06ebc6f68f
Author: Carlos Garnacho <carlos gnome org>
Date:   Mon Dec 7 20:51:44 2009 +0100

    GtkWidget: Respect multidevice awareness when changing widget state.
    
    Crossing events are now sent just once for GdkWindows that don't
    support multiple devices.

 gtk/gtkwidget.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index cb1293a..7d55fb0 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -9069,20 +9069,37 @@ gtk_widget_propagate_state (GtkWidget           *widget,
 
       if (!GTK_WIDGET_SHADOWED (widget))
         {
+          GList *event_windows = NULL;
           GList *devices, *d;
 
           devices = _gtk_widget_list_devices (widget);
 
           for (d = devices; d; d = d->next)
             {
+              GdkWindow *window;
+              GdkDevice *device;
+
+              device = d->data;
+              window = _gtk_widget_get_device_window (widget, device);
+
+              /* Do not propagate more than once to the
+               * same window if non-multidevice aware.
+               */
+              if (!gdk_window_get_support_multidevice (window) &&
+                  g_list_find (event_windows, window))
+                continue;
+
               if (!GTK_WIDGET_IS_SENSITIVE (widget))
                 _gtk_widget_synthesize_crossing (widget, NULL, d->data,
                                                  GDK_CROSSING_STATE_CHANGED);
               else if (old_state == GTK_STATE_INSENSITIVE)
                 _gtk_widget_synthesize_crossing (NULL, widget, d->data,
                                                  GDK_CROSSING_STATE_CHANGED);
+
+              event_windows = g_list_prepend (event_windows, window);
             }
 
+          g_list_free (event_windows);
           g_list_free (devices);
         }
 



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