console_t *uimon_window_open(void) { GtkWidget *scrollbar, *horizontal_container; if (fixed.window == NULL) { fixed.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(fixed.window), "VICE monitor"); gtk_window_set_position(GTK_WINDOW(fixed.window), GTK_WIN_POS_CENTER); gtk_widget_set_app_paintable(fixed.window, TRUE); gtk_window_set_deletable(GTK_WINDOW(fixed.window), TRUE); fixed.term = vte_terminal_new(); vte_terminal_set_scrollback_lines (VTE_TERMINAL(fixed.term), 1000); vte_terminal_set_scroll_on_output (VTE_TERMINAL(fixed.term), TRUE); scrollbar = gtk_vscrollbar_new(vte_terminal_get_adjustment (VTE_TERMINAL(fixed.term))); horizontal_container = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(fixed.window), horizontal_container); gtk_container_add(GTK_CONTAINER(horizontal_container), fixed.term); gtk_container_add(GTK_CONTAINER(horizontal_container), scrollbar); g_signal_connect(G_OBJECT(fixed.window), "delete-event", G_CALLBACK(close_window), &fixed.input_buffer); g_signal_connect(G_OBJECT(fixed.term), "key-press-event", G_CALLBACK(key_press_event), &fixed.input_buffer); g_signal_connect(G_OBJECT(fixed.term), "button-press-event", G_CALLBACK(button_press_event), &fixed.input_buffer); vte_console.console_xres = vte_terminal_get_column_count(VTE_TERMINAL(fixed.term)); vte_console.console_yres = vte_terminal_get_row_count(VTE_TERMINAL(fixed.term)); vte_console.console_can_stay_open = 1; } return uimon_window_resume(); }
console_t *uimon_window_open(void) { GtkWidget *scrollbar, *horizontal_container; GdkGeometry hints; if (fixed.window == NULL) { fixed.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(fixed.window), "VICE monitor"); gtk_window_set_position(GTK_WINDOW(fixed.window), GTK_WIN_POS_CENTER); gtk_widget_set_app_paintable(fixed.window, TRUE); gtk_window_set_deletable(GTK_WINDOW(fixed.window), TRUE); fixed.term = vte_terminal_new(); vte_terminal_set_scrollback_lines (VTE_TERMINAL(fixed.term), 1000); vte_terminal_set_scroll_on_output (VTE_TERMINAL(fixed.term), TRUE); /* allowed window widths are base_width + width_inc * N * allowed window heights are base_height + height_inc * N */ hints.width_inc = vte_terminal_get_char_width (VTE_TERMINAL(fixed.term)); hints.height_inc = vte_terminal_get_char_height (VTE_TERMINAL(fixed.term)); /* min size should be multiple of .._inc, else we get funky effects */ hints.min_width = hints.width_inc; hints.min_height = hints.height_inc; /* base size should be multiple of .._inc, else we get funky effects */ hints.base_width = hints.width_inc; hints.base_height = hints.height_inc; gtk_window_set_geometry_hints (GTK_WINDOW (fixed.window), fixed.term, &hints, GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE); #if GTK_CHECK_VERSION (2, 91, 1) { glong width, height; get_terminal_size_in_chars(VTE_TERMINAL(fixed.term), &width, &height); gtk_window_resize_to_geometry (GTK_WINDOW (fixed.window), width, height); } #endif scrollbar = gtk_vscrollbar_new(vte_terminal_get_adjustment (VTE_TERMINAL(fixed.term))); horizontal_container = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(fixed.window), horizontal_container); gtk_container_add(GTK_CONTAINER(horizontal_container), fixed.term); gtk_container_add(GTK_CONTAINER(horizontal_container), scrollbar); g_signal_connect(G_OBJECT(fixed.window), "delete-event", G_CALLBACK(close_window), &fixed.input_buffer); g_signal_connect(G_OBJECT(fixed.term), "key-press-event", G_CALLBACK(key_press_event), &fixed.input_buffer); g_signal_connect(G_OBJECT(fixed.term), "button-press-event", G_CALLBACK(button_press_event), &fixed.input_buffer); g_signal_connect (fixed.term, "text-modified", G_CALLBACK (screen_resize_window_cb), NULL); vte_console.console_can_stay_open = 1; } return uimon_window_resume(); }