im.pidgin.pidgin: ac040c5e99f54464b25a7cc17502c1d25413d9cb
sadrul at pidgin.im
sadrul at pidgin.im
Thu Jan 3 06:10:45 EST 2008
-----------------------------------------------------------------
Revision: ac040c5e99f54464b25a7cc17502c1d25413d9cb
Ancestor: 82b414ee3bf78684f9abfe73e3b25c9885de1571
Author: sadrul at pidgin.im
Date: 2008-01-03T11:12:36
Branch: im.pidgin.pidgin
Modified files:
doc/finch.1.in finch/libgnt/gntwm.c
ChangeLog:
New actions: window-next-urgent (alt+tab), and window-prev-urgent (alt+shift+tab).
-------------- next part --------------
============================================================
--- doc/finch.1.in 620c257dbbfa7daab6a0f8b4da6d7c6f46a5e19d
+++ doc/finch.1.in 1797cc644879a19fb6b368b8378a96a69014a606
@@ -105,6 +105,12 @@ Jump to the 1st, 2nd ... 10th window.
.B Alt \+ 1 2 ... 0
Jump to the 1st, 2nd ... 10th window.
.TP
+.B Alt \+ Tab
+Jump to the next URGENT (highlighted) window.
+.TP
+.B Alt \+ Shift \+ Tab
+Jump to the previous URGENT (highlighted) window.
+.TP
.B Ctrl \+ o
Bring up the menu (if there is one) for a window.
.TP
@@ -460,6 +466,7 @@ a-/ = help-for-widget
.br
# switch-window-n
.br
+# Other actions: window-next-urgent, window-prev-urgent
# For the sample custom window manager
.br
============================================================
--- finch/libgnt/gntwm.c ce13ad41615e73bc546144f8bbaf715d19e055b1
+++ finch/libgnt/gntwm.c 30451d3ff6c8189c488fe4a9160811524729ce5f
@@ -388,10 +388,10 @@ static void
}
static void
-switch_window(GntWM *wm, int direction)
+switch_window(GntWM *wm, int direction, gboolean urgent)
{
GntWidget *w = NULL, *wid = NULL;
- int pos;
+ int pos, orgpos;
if (wm->_list.window || wm->menu)
return;
@@ -404,16 +404,21 @@ switch_window(GntWM *wm, int direction)
}
w = wm->cws->ordered->data;
- pos = g_list_index(wm->cws->list, w);
- pos += direction;
+ orgpos = pos = g_list_index(wm->cws->list, w);
- if (pos < 0)
- wid = g_list_last(wm->cws->list)->data;
- else if (pos >= g_list_length(wm->cws->list))
- wid = wm->cws->list->data;
- else if (pos >= 0)
- wid = g_list_nth_data(wm->cws->list, pos);
+ do {
+ pos += direction;
+ if (pos < 0) {
+ wid = g_list_last(wm->cws->list)->data;
+ pos = g_list_length(wm->cws->list) - 1;
+ } else if (pos >= g_list_length(wm->cws->list)) {
+ wid = wm->cws->list->data;
+ pos = 0;
+ } else
+ wid = g_list_nth_data(wm->cws->list, pos);
+ } while (urgent && !GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT) && pos != orgpos);
+
gnt_wm_raise_window(wm, wid);
}
@@ -421,7 +426,7 @@ window_next(GntBindable *bindable, GList
window_next(GntBindable *bindable, GList *null)
{
GntWM *wm = GNT_WM(bindable);
- switch_window(wm, 1);
+ switch_window(wm, 1, FALSE);
return TRUE;
}
@@ -429,7 +434,7 @@ window_prev(GntBindable *bindable, GList
window_prev(GntBindable *bindable, GList *null)
{
GntWM *wm = GNT_WM(bindable);
- switch_window(wm, -1);
+ switch_window(wm, -1, FALSE);
return TRUE;
}
@@ -1202,6 +1207,22 @@ ignore_keys_end(GntBindable *bindable, G
return ignore_keys ? !(ignore_keys = FALSE) : FALSE;
}
+static gboolean
+window_next_urgent(GntBindable *bindable, GList *n)
+{
+ GntWM *wm = GNT_WM(bindable);
+ switch_window(wm, 1, TRUE);
+ return TRUE;
+}
+
+static gboolean
+window_prev_urgent(GntBindable *bindable, GList *n)
+{
+ GntWM *wm = GNT_WM(bindable);
+ switch_window(wm, -1, TRUE);
+ return TRUE;
+}
+
#ifdef USE_PYTHON
static void
python_script_selected(GntFileSel *fs, const char *path, const char *f, gpointer n)
@@ -1323,6 +1344,7 @@ gnt_wm_class_init(GntWMClass *klass)
{
int i;
GObjectClass *gclass = G_OBJECT_CLASS(klass);
+ char key[32];
gclass->dispose = gnt_wm_destroy;
@@ -1482,10 +1504,15 @@ gnt_wm_class_init(GntWMClass *klass)
"\033" "\\", NULL);
gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-window", help_for_window,
"\033" "|", NULL);
- gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-start", ignore_keys_start,
+ gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-start", ignore_keys_start,
GNT_KEY_CTRL_G, NULL);
- gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-end", ignore_keys_end,
+ gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-end", ignore_keys_end,
"\033" GNT_KEY_CTRL_G, NULL);
+ gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-next-urgent", window_next_urgent,
+ "\033" "\t", NULL);
+ snprintf(key, sizeof(key), "\033%s", GNT_KEY_BACK_TAB);
+ gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "window-prev-urgent", window_prev_urgent,
+ key[1] ? key : NULL, NULL);
#ifdef USE_PYTHON
gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "run-python", run_python,
GNT_KEY_F3, NULL);
More information about the Commits
mailing list