summaryrefslogtreecommitdiff
path: root/src/fe-text/gui-windows.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-02-10 04:43:21 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-02-10 04:43:21 +0000
commit0de0499fd86e9a5b996da2c2e9dd6df093ffeeaa (patch)
tree33345dd269f7de07cacfdf67ef88ca40fd35e17c /src/fe-text/gui-windows.c
parent89abfaf9cfe81846223e5e72324d7f812e60fdfa (diff)
downloadirssi-0de0499fd86e9a5b996da2c2e9dd6df093ffeeaa.zip
/WINDOW STICK [ON|OFF|<ref#>] - stick window to specified main window.
After setting window to sticky non-sticky windows can't replace the active sticky one. Each main window can have it's own sticky window group. /WINDOW LEFT, /WINDOW RIGHT - Go to previous/next window in the current sticky window group, or if there's no sticky windows go to previous/next non-sticky window. Alt-Left/Right keys default to these commands now. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1198 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text/gui-windows.c')
-rw-r--r--src/fe-text/gui-windows.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c
index 42eebfa8..6dfaa084 100644
--- a/src/fe-text/gui-windows.c
+++ b/src/fe-text/gui-windows.c
@@ -729,29 +729,59 @@ void gui_window_reparent(WINDOW_REC *window, MAIN_WINDOW_REC *parent)
int ychange;
oldparent = WINDOW_GUI(window)->parent;
- ychange = parent->lines - oldparent->lines;
+ if (oldparent == parent)
+ return;
WINDOW_GUI(window)->parent = parent;
+
+ ychange = parent->lines - oldparent->lines;
if (ychange != 0) gui_window_resize(window, ychange, FALSE);
}
+static MAIN_WINDOW_REC *mainwindow_find_unsticky(void)
+{
+ GSList *tmp;
+
+ for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
+ MAIN_WINDOW_REC *rec = tmp->data;
+
+ if (rec->sticky_windows == NULL)
+ return rec;
+ }
+
+ /* all windows are sticky, fallback to active window */
+ return active_mainwin;
+}
+
static void signal_window_changed(WINDOW_REC *window)
{
+ MAIN_WINDOW_REC *parent;
+
g_return_if_fail(window != NULL);
if (quitting) return;
+ parent = WINDOW_GUI(window)->parent;
if (is_window_visible(window)) {
- /* already visible, great! */
- active_mainwin = WINDOW_GUI(window)->parent;
+ /* already visible */
+ active_mainwin = parent;
+ } else if (active_mainwin == NULL) {
+ /* no main window set yet */
+ active_mainwin = parent;
+ } else if (g_slist_find(parent->sticky_windows, window) != NULL) {
+ /* window is sticky, switch to correct main window */
+ if (parent != active_mainwin)
+ active_mainwin = parent;
} else {
- /* move it to active main window */
- if (active_mainwin == NULL)
- active_mainwin = WINDOW_GUI(window)->parent;
- else
- gui_window_reparent(window, active_mainwin);
- active_mainwin->active = window;
+ /* move window to active main window */
+ if (active_mainwin->sticky_windows != NULL) {
+ /* active mainwindow is sticky, we'll need to
+ set the window active somewhere else */
+ active_mainwin = mainwindow_find_unsticky();
+ }
+ gui_window_reparent(window, active_mainwin);
}
+ active_mainwin->active = window;
screen_refresh_freeze();
window_update_prompt();