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 */ 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 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(); gui_window_redraw(window); screen_refresh_thaw(); }
static void signal_window_changed(WINDOW_REC *window) { MAIN_WINDOW_REC *parent; WINDOW_REC *old_window; g_return_if_fail(window != NULL); if (quitting) return; parent = WINDOW_MAIN(window); if (is_window_visible(window)) { /* already visible */ active_mainwin = parent; } else if (active_mainwin == NULL) { /* no main window set yet */ active_mainwin = parent; } else if (WINDOW_GUI(window)->sticky) { /* window is sticky, switch to correct main window */ if (parent != active_mainwin) active_mainwin = parent; } else { /* move window to active main window */ if (active_mainwin->sticky_windows) { /* 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); } old_window = active_mainwin->active; if (old_window != NULL && old_window != window) textbuffer_view_set_window(WINDOW_GUI(old_window)->view, NULL); active_mainwin->active = window; textbuffer_view_set_window(WINDOW_GUI(window)->view, active_mainwin->screen_win); if (WINDOW_GUI(window)->view->dirty) active_mainwin->dirty = TRUE; }