[Xfce4-commits] <xfce4-panel:xfce-4.8> Activate windows on button release events (bug #7296).
Nick Schermer
noreply at xfce.org
Fri Feb 25 21:08:10 CET 2011
Updating branch refs/heads/xfce-4.8
to a0a3d318c8d688f505f4fefe2ce81c0fc48b5cef (commit)
from 81957d1f009f8125b49ef8c2864328f7d0245467 (commit)
commit a0a3d318c8d688f505f4fefe2ce81c0fc48b5cef
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 | 38 +++++++++++++++++++++++++++--------
1 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 81cf744..81e6877 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -1894,8 +1894,8 @@ xfce_tasklist_child_drag_motion (XfceTasklistChild *child,
/* don't respond to dragging our own children or panel plugins */
dnd_widget = gtk_drag_get_source_widget (context);
if (dnd_widget == NULL
- || gtk_widget_get_parent (dnd_widget) != GTK_WIDGET (child->tasklist)
- || XFCE_IS_PANEL_PLUGIN (dnd_widget))
+ || (gtk_widget_get_parent (dnd_widget) != GTK_WIDGET (child->tasklist)
+ && !XFCE_IS_PANEL_PLUGIN (dnd_widget)))
{
child->motion_timestamp = timestamp;
if (child->motion_timeout_id == 0
@@ -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,30 @@ 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->y == 0) /* 0,0 = outside the widget in Gtk */
+ && event->x >= 0 && event->x < button->allocation.width
+ && event->y >= 0 && event->y < button->allocation.height)
+ {
+ xfce_tasklist_button_activate (child, event->time);
+ }
+
+ return FALSE;
+}
+
+
+
static void
xfce_tasklist_button_enter_notify_event_disconnected (gpointer data,
GClosure *closure)
@@ -2845,6 +2863,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