aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2016-08-28 16:50:55 -0400
committerJason Conti <jason.conti@gmail.com>2016-08-28 16:50:55 -0400
commit76d7872299ec8acf5fb3d65c72597a4a682fb52b (patch)
tree5ddc29b27a6aeca027d7a194b5e9477302c189f4 /src
parent39810bbf1c3128d0bcaf292e200776173de212cd (diff)
downloadayatana-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')
-rw-r--r--src/notification-menuitem.c14
-rw-r--r--src/notification-menuitem.h2
2 files changed, 12 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;
}
diff --git a/src/notification-menuitem.h b/src/notification-menuitem.h
index c44c105..2aa051e 100644
--- a/src/notification-menuitem.h
+++ b/src/notification-menuitem.h
@@ -37,6 +37,8 @@ struct _NotificationMenuItemPrivate {
GtkWidget *close_image;
GtkWidget *hbox;
GtkWidget *label;
+
+ gboolean pressed_close_image;
};
#define NOTIFICATION_MENUITEM_GET_PRIVATE(o) \