[Xfce4-commits] <xfce4-taskbar-plugin:master> Raise the only last activated instance on <Super>+<n>
Valentin Dudouyt
noreply at xfce.org
Sun Dec 2 09:06:01 CET 2012
Updating branch refs/heads/master
to 79a2fd6c65a5879ed25d76fe9dccb2757505ba58 (commit)
from c5dbd50e209fe008c88eb7f7de0717c06f04f8ca (commit)
commit 79a2fd6c65a5879ed25d76fe9dccb2757505ba58
Author: Valentin Dudouyt <valentin.dudouyt at gmail.com>
Date: Sun Dec 2 15:01:42 2012 +0700
Raise the only last activated instance on <Super>+<n>
taskbar-widget.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/taskbar-widget.c b/taskbar-widget.c
index 20a7ddc..bde51f0 100644
--- a/taskbar-widget.c
+++ b/taskbar-widget.c
@@ -185,6 +185,8 @@ struct _XfceTaskBarWNode
XfceTaskBarGroup *group ;
gboolean visible ;
+ /* last activated */
+ guint64 timestamp;
};
struct _XfceTaskBarGroup
@@ -1033,6 +1035,7 @@ static void xfce_taskbar_active_window_changed (WnckScreen *screen, WnckWindow *
if(wnode->window == active_window)
{
iconActive = TRUE ;
+ wnode->timestamp = g_get_real_time();
break ;
}
}
@@ -1752,8 +1755,18 @@ void xfce_taskbar_selgrp_cmd(XfceTaskBar *taskbar, char id) {
return;
XfceTaskBarWNode *first = g_slist_nth_data(group->wnodes, 0);
if(!first) {
+ // No instances are running
xfce_taskbar_group_button_launch_pinned(group);
- } else if (!wnck_window_is_active(first->window)) {
+ return;
+ }
+ // Trying to find an instance with greater timestamp
+ GSList *wi ;
+ for(wi=group->wnodes; wi != NULL; wi=wi->next) {
+ XfceTaskBarWNode *wnode = wi->data;
+ if(wnode->timestamp > first->timestamp)
+ first = wnode;
+ }
+ if (!wnck_window_is_active(first->window)) {
xfce_taskbar_button_activate(first, 0);
}
}
@@ -1940,6 +1953,7 @@ static XfceTaskBarWNode * xfce_taskbar_wnode_new (WnckWindow *window, XfceTaskBa
wnode->window = window;
wnode->group_name = g_strdup(wnck_application_get_name(wnck_window_get_application (window)));
wnode->visible = xfce_taskbar_button_visible(wnode, active_ws);
+ wnode->timestamp = g_get_real_time();
// monitor window changes
g_signal_connect (G_OBJECT (window), "icon-changed", G_CALLBACK (xfce_taskbar_button_icon_changed), wnode);
More information about the Xfce4-commits
mailing list