diff options
author | Jason Conti <jason.conti@gmail.com> | 2016-08-28 16:50:55 -0400 |
---|---|---|
committer | Jason Conti <jason.conti@gmail.com> | 2016-08-28 16:50:55 -0400 |
commit | 76d7872299ec8acf5fb3d65c72597a4a682fb52b (patch) | |
tree | 5ddc29b27a6aeca027d7a194b5e9477302c189f4 /src/notification-menuitem.c | |
parent | 39810bbf1c3128d0bcaf292e200776173de212cd (diff) | |
download | ayatana-indicator-notifications-76d7872299ec8acf5fb3d65c72597a4a682fb52b.tar.gz ayatana-indicator-notifications-76d7872299ec8acf5fb3d65c72597a4a682fb52b.tar.bz2 ayatana-indicator-notifications-76d7872299ec8acf5fb3d65c72597a4a682fb52b.zip |
* Make sure the button event started and ended on the close image before we
dismiss the notification
Diffstat (limited to 'src/notification-menuitem.c')
-rw-r--r-- | src/notification-menuitem.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/notification-menuitem.c b/src/notification-menuitem.c index 3240de1..b8ddd07 100644 --- a/src/notification-menuitem.c +++ b/src/notification-menuitem.c @@ -75,6 +75,8 @@ notification_menuitem_init(NotificationMenuItem *self) { self->priv = NOTIFICATION_MENUITEM_GET_PRIVATE(self); + self->priv->pressed_close_image = FALSE; + self->priv->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); self->priv->label = gtk_label_new(NULL); @@ -193,11 +195,13 @@ notification_menuitem_button_press(GtkWidget *widget, GdkEventButton *event) g_return_val_if_fail(IS_NOTIFICATION_MENUITEM(widget), FALSE); NotificationMenuItem *self = NOTIFICATION_MENUITEM(widget); - GtkWidget *label = self->priv->label; /* The context menu breaks everything so disable it for now */ - if (event->button == GDK_BUTTON_PRIMARY && widget_contains_event(label, event)) { - gtk_widget_event(label, (GdkEvent *)event); + if (event->button == GDK_BUTTON_PRIMARY && widget_contains_event(self->priv->label, event)) { + gtk_widget_event(self->priv->label, (GdkEvent *)event); + } + else if (widget_contains_event(self->priv->close_image, event)) { + self->priv->pressed_close_image = TRUE; } return TRUE; } @@ -218,7 +222,8 @@ notification_menuitem_button_release(GtkWidget *widget, GdkEventButton *event) NotificationMenuItem *self = NOTIFICATION_MENUITEM(widget); if (widget_contains_event(self->priv->close_image, event)) { - g_signal_emit(NOTIFICATION_MENUITEM(widget), notification_menuitem_signals[CLICKED], 0, event->button); + if (self->priv->pressed_close_image) + g_signal_emit(NOTIFICATION_MENUITEM(widget), notification_menuitem_signals[CLICKED], 0, event->button); } else { /* The context menu breaks everything so disable it for now */ @@ -226,6 +231,7 @@ notification_menuitem_button_release(GtkWidget *widget, GdkEventButton *event) gtk_widget_event(self->priv->label, (GdkEvent *)event); } } + self->priv->pressed_close_image = FALSE; return TRUE; } |