int is_wide;
} fontinfo[4];
int xpos, ypos, gotpos, gravity;
- GdkCursor *rawcursor, *textcursor, *blankcursor, *currcursor;
+ GdkCursor *rawcursor, *textcursor, *blankcursor, *waitcursor, *currcursor;
GdkColor cols[NALLCOLOURS];
GdkColormap *colmap;
wchar_t *pastein_data;
int width, height;
int ignore_sbar;
int mouseptr_visible;
+ int busy_status;
guint term_paste_idle_id;
int alt_keycode;
int alt_digits;
char *progname, **gtkargvstart;
int ngtkargs;
guint32 input_event_time; /* Timestamp of the most recent input event. */
+ int reconfiguring;
};
struct draw_ctx {
return FALSE;
}
+static void update_mouseptr(struct gui_data *inst)
+{
+ switch (inst->busy_status) {
+ case BUSY_NOT:
+ if (!inst->mouseptr_visible) {
+ gdk_window_set_cursor(inst->area->window, inst->blankcursor);
+ } else if (send_raw_mouse) {
+ gdk_window_set_cursor(inst->area->window, inst->rawcursor);
+ } else {
+ gdk_window_set_cursor(inst->area->window, inst->textcursor);
+ }
+ break;
+ case BUSY_WAITING: /* XXX can we do better? */
+ case BUSY_CPU:
+ /* We always display these cursors. */
+ gdk_window_set_cursor(inst->area->window, inst->waitcursor);
+ break;
+ default:
+ assert(0);
+ }
+}
+
static void show_mouseptr(struct gui_data *inst, int show)
{
if (!inst->cfg.hide_mouseptr)
show = 1;
- if (show)
- gdk_window_set_cursor(inst->area->window, inst->currcursor);
- else
- gdk_window_set_cursor(inst->area->window, inst->blankcursor);
inst->mouseptr_visible = show;
+ update_mouseptr(inst);
}
void draw_backing_rect(struct gui_data *inst)
inst->exited = TRUE;
if (inst->cfg.close_on_exit == FORCE_ON ||
(inst->cfg.close_on_exit == AUTO && exitcode == 0))
- exit(0); /* just go. */
+ gtk_main_quit(); /* just go */
if (inst->ldisc) {
ldisc_free(inst->ldisc);
inst->ldisc = NULL;
return FALSE;
}
+void set_busy_status(void *frontend, int status)
+{
+ struct gui_data *inst = (struct gui_data *)frontend;
+ inst->busy_status = status;
+ update_mouseptr(inst);
+}
+
/*
* set or clear the "raw mouse message" mode
*/
struct gui_data *inst = (struct gui_data *)frontend;
activate = activate && !inst->cfg.no_mouse_rep;
send_raw_mouse = activate;
- if (send_raw_mouse)
- inst->currcursor = inst->rawcursor;
- else
- inst->currcursor = inst->textcursor;
- show_mouseptr(inst, inst->mouseptr_visible);
+ update_mouseptr(inst);
}
void request_resize(void *frontend, int w, int h)
} else if(!strcmp(p, "-help") || !strcmp(p, "--help")) {
help(stdout);
exit(0);
-
+
+ } else if (!strcmp(p, "-pgpfp")) {
+ pgp_fingerprints();
+ exit(1);
+
} else if(p[0] != '-' && (!do_everything ||
process_nonoption_arg(p, cfg))) {
/* do nothing */
assert(lenof(ww) == NCFGCOLOURS);
+ if (inst->reconfiguring)
+ return;
+ else
+ inst->reconfiguring = TRUE;
+
cfg2 = inst->cfg; /* structure copy */
if (do_config_box(title, &cfg2, 1,
gtk_widget_queue_draw(inst->area);
}
sfree(title);
+ inst->reconfiguring = FALSE;
}
void fork_and_exec_self(struct gui_data *inst, int fd_to_close, ...)
sfree(str);
}
+static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data)
+{
+ struct gui_data *inst = (struct gui_data *)data;
+ struct sesslist sesslist;
+ int i;
+
+ gtk_container_foreach(GTK_CONTAINER(inst->sessionsmenu),
+ (GtkCallback)gtk_widget_destroy, NULL);
+
+ get_sesslist(&sesslist, TRUE);
+ for (i = 1; i < sesslist.nsessions; i++) {
+ GtkWidget *menuitem =
+ gtk_menu_item_new_with_label(sesslist.sessions[i]);
+ gtk_container_add(GTK_CONTAINER(inst->sessionsmenu), menuitem);
+ gtk_widget_show(menuitem);
+ gtk_object_set_data(GTK_OBJECT(menuitem), "user-data",
+ dupstr(sesslist.sessions[i]));
+ gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
+ GTK_SIGNAL_FUNC(saved_session_menuitem),
+ inst);
+ gtk_signal_connect(GTK_OBJECT(menuitem), "destroy",
+ GTK_SIGNAL_FUNC(saved_session_freedata),
+ inst);
+ }
+ get_sesslist(&sesslist, FALSE); /* free up */
+}
+
void update_specials_menu(void *frontend)
{
struct gui_data *inst = (struct gui_data *)frontend;
inst = snew(struct gui_data);
memset(inst, 0, sizeof(*inst));
inst->alt_keycode = -1; /* this one needs _not_ to be zero */
+ inst->busy_status = BUSY_NOT;
/* defer any child exit handling until we're ready to deal with
* it */
gtk_widget_hide(inst->restartitem);
MKMENUITEM("Duplicate Session", dup_session_menuitem);
if (saved_sessions) {
- struct sesslist sesslist;
- int i;
-
inst->sessionsmenu = gtk_menu_new();
-
- get_sesslist(&sesslist, TRUE);
- for (i = 1; i < sesslist.nsessions; i++) {
- menuitem = gtk_menu_item_new_with_label(sesslist.sessions[i]);
- gtk_container_add(GTK_CONTAINER(inst->sessionsmenu), menuitem);
- gtk_widget_show(menuitem);
- gtk_object_set_data(GTK_OBJECT(menuitem), "user-data",
- dupstr(sesslist.sessions[i]));
- gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
- GTK_SIGNAL_FUNC(saved_session_menuitem),
- inst);
- gtk_signal_connect(GTK_OBJECT(menuitem), "destroy",
- GTK_SIGNAL_FUNC(saved_session_freedata),
- inst);
- }
- get_sesslist(&sesslist, FALSE);
-
- MKMENUITEM("Saved Sessions", NULL);
+ /* sessionsmenu will be updated when it's invoked */
+ /* XXX is this the right way to do dynamic menus in Gtk? */
+ MKMENUITEM("Saved Sessions", update_savedsess_menu);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),
inst->sessionsmenu);
}
inst->textcursor = make_mouse_ptr(inst, GDK_XTERM);
inst->rawcursor = make_mouse_ptr(inst, GDK_LEFT_PTR);
+ inst->waitcursor = make_mouse_ptr(inst, GDK_WATCH);
inst->blankcursor = make_mouse_ptr(inst, -1);
make_mouse_ptr(inst, -2); /* clean up cursor font */
inst->currcursor = inst->textcursor;