Ejemplo n.º 1
0
static GUI_WINDOW_REC *gui_window_init(WINDOW_REC *window,
				       MAIN_WINDOW_REC *parent)
{
	GUI_WINDOW_REC *gui;

	window->width = parent->width;
        window->height = MAIN_WINDOW_TEXT_HEIGHT(parent);

	gui = g_new0(GUI_WINDOW_REC, 1);
	gui->parent = parent;
	gui->view = textbuffer_view_create(textbuffer_create(),
					   window->width, window->height,
					   settings_get_bool("scroll"),
					   term_type == TERM_TYPE_UTF8);
	textbuffer_view_set_default_indent(gui->view,
					   settings_get_int("indent"),
					   !settings_get_bool("indent_always"),
					   get_default_indent_func());
	textbuffer_view_set_break_wide(gui->view, settings_get_bool("break_wide"));
	wcwidth_impl = settings_get_choice("wcwidth_implementation");
	textbuffer_view_set_hidden_level(gui->view, settings_get_level("window_default_hidelevel"));
	if (parent->active == window)
		textbuffer_view_set_window(gui->view, parent->screen_win);
	return gui;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
void mainwindows_recreate(void)
{
	GSList *tmp;

	for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) {
		MAIN_WINDOW_REC *rec = tmp->data;

		rec->screen_win = mainwindow_create_screen(rec);
                rec->dirty = TRUE;
		textbuffer_view_set_window(WINDOW_GUI(rec->active)->view,
					   rec->screen_win);
	}
}
Ejemplo n.º 4
0
void gui_window_reparent(WINDOW_REC *window, MAIN_WINDOW_REC *parent)
{
	MAIN_WINDOW_REC *oldparent;

	oldparent = WINDOW_MAIN(window);
	if (oldparent == parent)
		return;

        gui_window_set_unsticky(window);
	textbuffer_view_set_window(WINDOW_GUI(window)->view, NULL);

	WINDOW_MAIN(window) = parent;
        if (parent->sticky_windows)
		gui_window_set_sticky(window);

	if (MAIN_WINDOW_TEXT_HEIGHT(parent) !=
	    MAIN_WINDOW_TEXT_HEIGHT(oldparent) ||
	    parent->width != oldparent->width) {
		gui_window_resize(window, parent->width,
				  MAIN_WINDOW_TEXT_HEIGHT(parent));
	}
}