예제 #1
0
파일: term.c 프로젝트: jinksong/stjerm
GtkWidget* build_term(void)
{
    if(!popupmenu)
        build_popupmenu();

    GtkWidget* term = vte_terminal_new();

    term_fork_command(VTE_TERMINAL(term), conf_get_shell());
    
    if (conf_get_bg_image() != NULL)
        vte_terminal_set_background_image_file(VTE_TERMINAL(term), conf_get_bg_image());
    
    GdkColor fore, back;
    fore = conf_get_fg();
    back = conf_get_bg();
    GdkColor *palette = conf_get_color_palette();
    
    if(palette == NULL)
        vte_terminal_set_colors(VTE_TERMINAL(term), &fore, &back, NULL, 0);
    else
        vte_terminal_set_colors(VTE_TERMINAL(term), &fore, &back, palette, 16);
    
    #if VTE_CHECK_VERSION(0,25,0)
    vte_pty_set_term(vte_terminal_get_pty_object(VTE_TERMINAL(term)), conf_get_emulation());
    #endif
    
    vte_terminal_set_background_tint_color(VTE_TERMINAL(term), &back);

    vte_terminal_set_allow_bold(VTE_TERMINAL(term), conf_get_allow_bold());
    vte_terminal_set_scroll_on_output(VTE_TERMINAL(term), conf_get_scroll_on_output());
    vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(term), TRUE);
    vte_terminal_set_font_from_string(VTE_TERMINAL(term), conf_get_font());
    vte_terminal_set_scrollback_lines(VTE_TERMINAL(term), conf_get_lines());
    vte_terminal_set_backspace_binding(VTE_TERMINAL(term), 
        VTE_ERASE_ASCII_DELETE);
    vte_terminal_set_word_chars(VTE_TERMINAL(term),
        "-A-Za-z0-9_$.+!*(),;:@&=?/~#%");

    GdkColor cursor = conf_get_cursor_color();

    vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(term), conf_get_cursor_blink() ?
        VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF);
    vte_terminal_set_cursor_shape(VTE_TERMINAL(term), conf_get_cursor_shape());
    vte_terminal_set_color_cursor(VTE_TERMINAL(term), &cursor);
    

    term_connect_signals(term);

    return term;
}
예제 #2
0
파일: term.c 프로젝트: icebreaker/stjerm
GtkWidget* build_term(void) {
    if (!popupmenu)
        build_popupmenu();

    GtkWidget* term = vte_terminal_new();

    vte_terminal_fork_command(VTE_TERMINAL(term), conf_get_shell(), NULL, NULL,
            "", TRUE, TRUE, TRUE);
    
    if (conf_get_bg_image() != NULL)
        vte_terminal_set_background_image_file(VTE_TERMINAL(term), conf_get_bg_image());
    
    GdkColor fore, back;
    fore = conf_get_fg();
    back = conf_get_bg();
    GdkColor *palette = conf_get_color_palette();
    if (palette == NULL)
        vte_terminal_set_colors(VTE_TERMINAL(term), &fore, &back, NULL, 0);
    else
        vte_terminal_set_colors(VTE_TERMINAL(term), &fore, &back, palette, 16);
    vte_terminal_set_background_tint_color(VTE_TERMINAL(term), &back);

    vte_terminal_set_allow_bold(VTE_TERMINAL(term), conf_get_allow_bold());
    vte_terminal_set_scroll_on_output(VTE_TERMINAL(term), conf_get_scroll_on_output());
    vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(term), TRUE);
    vte_terminal_set_font_from_string(VTE_TERMINAL(term), conf_get_font());
    vte_terminal_set_scrollback_lines(VTE_TERMINAL(term), conf_get_lines());
    vte_terminal_set_backspace_binding(VTE_TERMINAL(term), 
            VTE_ERASE_ASCII_DELETE);
    vte_terminal_set_audible_bell (VTE_TERMINAL(term), conf_get_bell());
	vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(term), conf_get_cursor_blink());
	vte_terminal_set_cursor_shape(VTE_TERMINAL(term), conf_get_cursor_shape());
    
    term_connect_signals(term);
    return term;
}
예제 #3
0
void mainwindow_create_tab(void) {
    GtkWidget* tmp_term = build_term();
    GtkVScrollbar *sbar= NULL;
    GtkHBox *tmp_box = GTK_HBOX(gtk_hbox_new(FALSE, 0));

    if (conf_get_scrollbar() == -1)
        gtk_box_pack_start(GTK_BOX(tmp_box), tmp_term, TRUE, TRUE, 0);
    else if (conf_get_scrollbar() == POS_LEFT) {
        sbar = GTK_VSCROLLBAR(gtk_vscrollbar_new(vte_terminal_get_adjustment(
        VTE_TERMINAL(tmp_term))));
        gtk_box_pack_start(GTK_BOX(tmp_box), GTK_WIDGET(sbar), FALSE, FALSE, 0);
        gtk_box_pack_end(GTK_BOX(tmp_box), GTK_WIDGET(tmp_term), TRUE, TRUE, 0);
    } else // (conf_get_scrollbar() == POS_RIGHT)
    {
        sbar = GTK_VSCROLLBAR(gtk_vscrollbar_new(vte_terminal_get_adjustment(
        VTE_TERMINAL(tmp_term))));
        gtk_box_pack_start(GTK_BOX(tmp_box), GTK_WIDGET(tmp_term), TRUE, TRUE, 0);
        gtk_box_pack_end(GTK_BOX(tmp_box), GTK_WIDGET(sbar), FALSE, FALSE, 0);
    }

    char buffer [100];
    sprintf(buffer, "%s %d", conf_get_term_name(), activetab + 1);
    GtkLabel* tmp_label = GTK_LABEL(gtk_label_new(buffer));

    if (conf_get_opacity() < 100) {
        if (screen_is_composited) {
            vte_terminal_set_background_transparent(VTE_TERMINAL(tmp_term), FALSE);
            vte_terminal_set_opacity(VTE_TERMINAL(tmp_term),
            conf_get_opacity()/100 * 0xffff);
        } else {
            vte_terminal_set_background_saturation(VTE_TERMINAL(tmp_term),
                1.0 - conf_get_opacity()/100);
            if (conf_get_bg_image() == NULL)
                vte_terminal_set_background_transparent(VTE_TERMINAL(tmp_term), TRUE);
        }
    }

    if (conf_get_opacity() < 100 && screen_is_composited) {
        vte_terminal_set_background_transparent(VTE_TERMINAL(tmp_term), FALSE);
        vte_terminal_set_opacity(VTE_TERMINAL(tmp_term),
        conf_get_opacity()/100 * 0xffff);
    }
    g_signal_connect(G_OBJECT(tmp_term), "window-title-changed",
            G_CALLBACK(mainwindow_window_title_changed), tmp_label);

    g_array_append_val(tabs, tmp_term);
    tabcount++;

    gtk_widget_show_all(GTK_WIDGET(tmp_box));
    gtk_notebook_append_page(tabbar, GTK_WIDGET(tmp_box), GTK_WIDGET(tmp_label));

    if (conf_get_tab_fill())
        gtk_container_child_set(GTK_CONTAINER(tabbar), GTK_WIDGET(tmp_box),
                "tab-expand", TRUE, "tab-fill", TRUE, NULL);

    if (conf_get_show_tab() == TABS_ONE&& tabcount > 1)
        gtk_notebook_set_show_tabs(tabbar, TRUE);

    activetab = tabcount - 1;
    gtk_notebook_set_current_page(tabbar, activetab);
}