[Xfce4-commits] <xfce4-panel:master> Activate windows on button release events (bug #7296).

Nick Schermer noreply at xfce.org
Sat Feb 19 17:06:06 CET 2011


Updating branch refs/heads/master
         to a0c69aa93bcaa82790a8aa3c1b6c7b9285a4fe08 (commit)
       from c73fec644730c078bee2e0893839fb89ba89c7a6 (commit)

commit a0c69aa93bcaa82790a8aa3c1b6c7b9285a4fe08
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Feb 19 17:00:08 2011 +0100

    Activate windows on button release events (bug #7296).

 plugins/tasklist/tasklist-widget.c |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 15ff7bf..13a47e4 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -2557,13 +2557,7 @@ xfce_tasklist_button_button_press_event (GtkWidget         *button,
       return TRUE;
     }
 
-  if (event->button == 1)
-    {
-      xfce_tasklist_button_activate (child, event->time);
-
-      return TRUE;
-    }
-  else if (event->button == 3)
+  if (event->button == 3)
     {
       menu = wnck_action_menu_new (child->window);
       g_signal_connect (G_OBJECT (menu), "selection-done",
@@ -2584,6 +2578,29 @@ xfce_tasklist_button_button_press_event (GtkWidget         *button,
 
 
 
+static gboolean
+xfce_tasklist_button_button_release_event (GtkWidget         *button,
+                                           GdkEventButton    *event,
+                                           XfceTasklistChild *child)
+{
+  panel_return_val_if_fail (XFCE_IS_TASKLIST (child->tasklist), FALSE);
+  panel_return_val_if_fail (child->type != CHILD_TYPE_GROUP, FALSE);
+
+  /* only respond to in-button events */
+  if (event->type == GDK_BUTTON_RELEASE
+      && !xfce_taskbar_is_locked (child->tasklist)
+      && event->button == 1
+      && event->x > 0 && event->x < button->allocation.width
+      && event->y > 0 && event->y < button->allocation.width)
+    {
+      xfce_tasklist_button_activate (child, event->time);
+    }
+
+  return FALSE;
+}
+
+
+
 static void
 xfce_tasklist_button_enter_notify_event_disconnected (gpointer  data,
                                                       GClosure *closure)
@@ -2841,6 +2858,8 @@ xfce_tasklist_button_new (WnckWindow   *window,
       G_CALLBACK (xfce_tasklist_button_enter_notify_event), child);
   g_signal_connect (G_OBJECT (child->button), "button-press-event",
       G_CALLBACK (xfce_tasklist_button_button_press_event), child);
+  g_signal_connect (G_OBJECT (child->button), "button-release-event",
+      G_CALLBACK (xfce_tasklist_button_button_release_event), child);
 
   /* monitor window changes */
   g_signal_connect (G_OBJECT (window), "icon-changed",



More information about the Xfce4-commits mailing list