diff options
author | Benjamin Otte <otte@redhat.com> | 2014-09-16 04:17:01 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2014-09-16 04:30:01 +0200 |
commit | 6b16c795babec299ed8f0ff31fb758ddaac1eafa (patch) | |
tree | 53d27a8a4e92ae4af72af0fff4c0cf7c8faec91b /gtk/gtkiconview.c | |
parent | 072c417416006d041f2cc17701c2b557c9d16152 (diff) | |
download | gtk+-6b16c795babec299ed8f0ff31fb758ddaac1eafa.tar.gz |
iconview: Unset prelit item in leave-notify
We don't want to keep a prelit item when the mouse cursor is elsewhere.
Diffstat (limited to 'gtk/gtkiconview.c')
-rw-r--r-- | gtk/gtkiconview.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index bdafff7ce2..e1462ee082 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -156,6 +156,8 @@ static gboolean gtk_icon_view_draw (GtkWidget cairo_t *cr); static gboolean gtk_icon_view_motion (GtkWidget *widget, GdkEventMotion *event); +static gboolean gtk_icon_view_leave (GtkWidget *widget, + GdkEventCrossing *event); static gboolean gtk_icon_view_button_press (GtkWidget *widget, GdkEventButton *event); static gboolean gtk_icon_view_button_release (GtkWidget *widget, @@ -357,6 +359,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass) widget_class->size_allocate = gtk_icon_view_size_allocate; widget_class->draw = gtk_icon_view_draw; widget_class->motion_notify_event = gtk_icon_view_motion; + widget_class->leave_notify_event = gtk_icon_view_leave; widget_class->button_press_event = gtk_icon_view_button_press; widget_class->button_release_event = gtk_icon_view_button_release; widget_class->key_press_event = gtk_icon_view_key_press; @@ -1307,6 +1310,7 @@ gtk_icon_view_realize (GtkWidget *widget) GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK | GDK_POINTER_MOTION_MASK | + GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | @@ -2058,6 +2062,25 @@ gtk_icon_view_motion (GtkWidget *widget, return TRUE; } +static gboolean +gtk_icon_view_leave (GtkWidget *widget, + GdkEventCrossing *event) +{ + GtkIconView *icon_view; + GtkIconViewPrivate *priv; + + icon_view = GTK_ICON_VIEW (widget); + priv = icon_view->priv; + + if (priv->last_prelight) + { + gtk_icon_view_queue_draw_item (icon_view, priv->last_prelight); + priv->last_prelight = NULL; + } + + return FALSE; +} + static void gtk_icon_view_remove (GtkContainer *container, GtkWidget *widget) |