[gnome-applets/wip/segeiger/window-picker/task-title: 1/3] windowpicker: use 'clicked' signal in TaskTitle button
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/segeiger/window-picker/task-title: 1/3] windowpicker: use 'clicked' signal in TaskTitle button
- Date: Tue, 16 Feb 2016 20:55:39 +0000 (UTC)
commit dd79a5b0c6d1f99cf77b8151bd1badf9f06a75ac
Author: Sebastian Geiger <sbastig gmx net>
Date: Tue Feb 16 20:34:03 2016 +0100
windowpicker: use 'clicked' signal in TaskTitle button
By using the 'clicked' signal the window is no longer closed, when the mouse
button is pressed down and instead correctly closes the window only when the
mouse button is released.
We still need the 'button-press-event' signal to stop right clicks from
propagating into the panel.
windowpicker/src/wp-task-title.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/windowpicker/src/wp-task-title.c b/windowpicker/src/wp-task-title.c
index c32d8d1..b4bbdcc 100644
--- a/windowpicker/src/wp-task-title.c
+++ b/windowpicker/src/wp-task-title.c
@@ -91,12 +91,19 @@ button_press_event_cb (GtkButton *button,
GdkEventButton *event,
gpointer user_data)
{
- WpTaskTitle *title;
- const gchar *icon;
-
if (event->button != 1)
return GDK_EVENT_STOP;
+ return GDK_EVENT_PROPAGATE;
+}
+
+static gboolean
+button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ WpTaskTitle *title;
+ const gchar *icon;
+
title = WP_TASK_TITLE (user_data);
gtk_image_get_icon_name (GTK_IMAGE (title->image), &icon, NULL);
@@ -105,7 +112,6 @@ button_press_event_cb (GtkButton *button,
{
WnckScreen *screen;
WnckWindow *active_window;
- GdkEventButton *event_button;
screen = wnck_screen_get_default ();
active_window = wnck_screen_get_active_window (screen);
@@ -116,10 +122,10 @@ button_press_event_cb (GtkButton *button,
if (title->active_window != active_window)
return FALSE;
- event_button = (GdkEventButton *) event;
-
disconnect_active_window (title);
- wnck_window_close (active_window, event_button->time);
+ wnck_window_close (active_window, gtk_get_current_event_time ());
+
+ return GDK_EVENT_STOP;
}
else if (g_strcmp0 (icon, LOGOUT_ICON) == 0)
{
@@ -127,6 +133,8 @@ button_press_event_cb (GtkButton *button,
g_variant_new ("(u)", 0), G_DBUS_CALL_FLAGS_NONE,
-1, NULL, (GAsyncReadyCallback) logout_ready_callback,
title);
+
+ return GDK_EVENT_STOP;
}
else
{
@@ -547,6 +555,9 @@ wp_task_title_setup_button (WpTaskTitle *title)
gtk_box_pack_start (GTK_BOX (title), title->button, FALSE, FALSE, 0);
gtk_widget_show (title->button);
+ g_signal_connect (title->button, "clicked",
+ G_CALLBACK (button_clicked_cb), title);
+
g_signal_connect (title->button, "button-press-event",
G_CALLBACK (button_press_event_cb), title);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]