diff --git a/be_misc.c b/be_misc.c index 9fcfec55..4774bd70 100644 --- a/be_misc.c +++ b/be_misc.c @@ -9,7 +9,7 @@ #include "putty.h" #include "network.h" -void backend_socket_log(void *frontend, int type, SockAddr addr, int port, +void backend_socket_log(Frontend *frontend, int type, SockAddr addr, int port, const char *error_msg, int error_code, Conf *conf, int session_started) { diff --git a/callback.c b/callback.c index 10f923d0..0a05f624 100644 --- a/callback.c +++ b/callback.c @@ -17,13 +17,13 @@ struct callback { struct callback *cbcurr = NULL, *cbhead = NULL, *cbtail = NULL; toplevel_callback_notify_fn_t notify_frontend = NULL; -void *frontend = NULL; +void *notify_ctx = NULL; void request_callback_notifications(toplevel_callback_notify_fn_t fn, - void *fr) + void *ctx) { notify_frontend = fn; - frontend = fr; + notify_ctx = ctx; } static void run_idempotent_callback(void *ctx) @@ -87,7 +87,7 @@ void queue_toplevel_callback(toplevel_callback_fn_t fn, void *ctx) * callback keeps re-scheduling itself. */ if (notify_frontend && !cbhead && !cbcurr) - notify_frontend(frontend); + notify_frontend(notify_ctx); if (cbtail) cbtail->next = cb; diff --git a/defs.h b/defs.h index 43f56dfe..53ded962 100644 --- a/defs.h +++ b/defs.h @@ -49,6 +49,8 @@ typedef struct Backend_vtable Backend_vtable; typedef struct Ldisc_tag Ldisc; typedef struct LogContext_tag LogContext; +typedef struct Frontend Frontend; + typedef struct ssh_tag *Ssh; /* Note indirection: for historical reasons (it used to be closer to diff --git a/fuzzterm.c b/fuzzterm.c index cdefb0d9..fda9f6c8 100644 --- a/fuzzterm.c +++ b/fuzzterm.c @@ -38,12 +38,12 @@ int main(int argc, char **argv) return 0; } -int from_backend(void *frontend, int is_stderr, const void *data, int len) +int from_backend(Frontend *frontend, int is_stderr, const void *data, int len) { return 0; } /* functions required by terminal.c */ -void request_resize(void *frontend, int x, int y) { } +void request_resize(Frontend *frontend, int x, int y) { } void do_text(Context ctx, int x, int y, wchar_t * text, int len, unsigned long attr, int lattr, truecolour tc) { @@ -67,40 +67,40 @@ void do_cursor(Context ctx, int x, int y, wchar_t * text, int len, printf("\n"); } int char_width(Context ctx, int uc) { return 1; } -void set_title(void *frontend, char *t) { } -void set_icon(void *frontend, char *t) { } -void set_sbar(void *frontend, int a, int b, int c) { } +void set_title(Frontend *frontend, char *t) { } +void set_icon(Frontend *frontend, char *t) { } +void set_sbar(Frontend *frontend, int a, int b, int c) { } void ldisc_send(Ldisc *ldisc, const void *buf, int len, int interactive) {} void ldisc_echoedit_update(Ldisc *ldisc) {} -Context get_ctx(void *frontend) { +Context get_ctx(Frontend *frontend) { static char x; return &x; } void free_ctx(Context ctx) { } -void palette_set(void *frontend, int a, int b, int c, int d) { } -void palette_reset(void *frontend) { } -int palette_get(void *frontend, int n, int *r, int *g, int *b) {return FALSE;} -void write_clip(void *frontend, int clipboard, +void palette_set(Frontend *frontend, int a, int b, int c, int d) { } +void palette_reset(Frontend *frontend) { } +int palette_get(Frontend *frontend, int n, int *r, int *g, int *b) {return FALSE;} +void write_clip(Frontend *frontend, int clipboard, wchar_t *a, int *b, truecolour *c, int d, int e) { } -void set_raw_mouse_mode(void *frontend, int m) { } -void frontend_request_paste(void *frontend, int clipboard) { } -void do_beep(void *frontend, int a) { } -void sys_cursor(void *frontend, int x, int y) { } +void set_raw_mouse_mode(Frontend *frontend, int m) { } +void frontend_request_paste(Frontend *frontend, int clipboard) { } +void do_beep(Frontend *frontend, int a) { } +void sys_cursor(Frontend *frontend, int x, int y) { } void modalfatalbox(const char *fmt, ...) { exit(0); } void nonfatal(const char *fmt, ...) { } -void set_iconic(void *frontend, int iconic) { } -void move_window(void *frontend, int x, int y) { } -void set_zorder(void *frontend, int top) { } -void refresh_window(void *frontend) { } -void set_zoomed(void *frontend, int zoomed) { } -int is_iconic(void *frontend) { return 0; } -void get_window_pos(void *frontend, int *x, int *y) { *x = 0; *y = 0; } -void get_window_pixels(void *frontend, int *x, int *y) { *x = 0; *y = 0; } -char *get_window_title(void *frontend, int icon) { return "moo"; } -int frontend_is_utf8(void *frontend) { return TRUE; } +void set_iconic(Frontend *frontend, int iconic) { } +void move_window(Frontend *frontend, int x, int y) { } +void set_zorder(Frontend *frontend, int top) { } +void refresh_window(Frontend *frontend) { } +void set_zoomed(Frontend *frontend, int zoomed) { } +int is_iconic(Frontend *frontend) { return 0; } +void get_window_pos(Frontend *frontend, int *x, int *y) { *x = 0; *y = 0; } +void get_window_pixels(Frontend *frontend, int *x, int *y) { *x = 0; *y = 0; } +char *get_window_title(Frontend *frontend, int icon) { return "moo"; } +int frontend_is_utf8(Frontend *frontend) { return TRUE; } /* needed by timing.c */ void timer_change_notify(unsigned long next) { } @@ -142,8 +142,8 @@ int dlg_coloursel_results(union control *ctrl, void *dlg, void dlg_refresh(union control *ctrl, void *dlg) { } /* miscellany */ -void logevent(void *frontend, const char *msg) { } -int askappend(void *frontend, Filename *filename, +void logevent(Frontend *frontend, const char *msg) { } +int askappend(Frontend *frontend, Filename *filename, void (*callback)(void *ctx, int result), void *ctx) { return 0; } const char *const appname = "FuZZterm"; diff --git a/ldisc.c b/ldisc.c index 3596ea63..e17b13c7 100644 --- a/ldisc.c +++ b/ldisc.c @@ -78,7 +78,7 @@ static void bsb(Ldisc *ldisc, int n) #define KCTRL(x) ((x^'@') | 0x100) Ldisc *ldisc_create(Conf *conf, Terminal *term, - Backend *backend, void *frontend) + Backend *backend, Frontend *frontend) { Ldisc *ldisc = snew(Ldisc); diff --git a/ldisc.h b/ldisc.h index af7afde3..e3d043b5 100644 --- a/ldisc.h +++ b/ldisc.h @@ -11,7 +11,7 @@ struct Ldisc_tag { Terminal *term; Backend *backend; - void *frontend; + Frontend *frontend; /* * Values cached out of conf. diff --git a/logging.c b/logging.c index 75c457e3..b1fb638b 100644 --- a/logging.c +++ b/logging.c @@ -17,7 +17,7 @@ struct LogContext_tag { enum { L_CLOSED, L_OPENING, L_OPEN, L_ERROR } state; bufchain queue; Filename *currlogfilename; - void *frontend; + Frontend *frontend; Conf *conf; int logtype; /* cached out of conf */ }; @@ -367,7 +367,7 @@ void log_packet(LogContext *ctx, int direction, int type, logflush(ctx); } -LogContext *log_init(void *frontend, Conf *conf) +LogContext *log_init(Frontend *frontend, Conf *conf) { LogContext *ctx = snew(LogContext); ctx->lgfp = NULL; diff --git a/misc.c b/misc.c index 92890322..fdd5635c 100644 --- a/misc.c +++ b/misc.c @@ -216,7 +216,7 @@ char *host_strduptrim(const char *s) return dupstr(s); } -prompts_t *new_prompts(void *frontend) +prompts_t *new_prompts(Frontend *frontend) { prompts_t *p = snew(prompts_t); p->prompts = NULL; diff --git a/network.h b/network.h index 9914ce34..79f44f5e 100644 --- a/network.h +++ b/network.h @@ -95,7 +95,8 @@ Socket new_connection(SockAddr addr, const char *hostname, Socket new_listener(const char *srcaddr, int port, Plug plug, int local_host_only, Conf *conf, int addressfamily); SockAddr name_lookup(const char *host, int port, char **canonicalname, - Conf *conf, int addressfamily, void *frontend_for_logging, + Conf *conf, int addressfamily, + Frontend *frontend_for_logging, const char *lookup_reason_for_logging); int proxy_for_destination (SockAddr addr, const char *hostname, int port, Conf *conf); @@ -221,7 +222,7 @@ extern Plug nullplug; /* * Exports from be_misc.c. */ -void backend_socket_log(void *frontend, int type, SockAddr addr, int port, +void backend_socket_log(Frontend *frontend, int type, SockAddr addr, int port, const char *error_msg, int error_code, Conf *conf, int session_started); void log_proxy_stderr(Plug plug, bufchain *buf, const void *vdata, int len); diff --git a/proxy.c b/proxy.c index 6ccd4025..f55973fc 100644 --- a/proxy.c +++ b/proxy.c @@ -368,7 +368,7 @@ static char *dns_log_msg(const char *host, int addressfamily, } SockAddr name_lookup(const char *host, int port, char **canonicalname, - Conf *conf, int addressfamily, void *frontend, + Conf *conf, int addressfamily, Frontend *frontend, const char *reason) { char *logmsg; diff --git a/pscp.c b/pscp.c index 854e6815..594f119f 100644 --- a/pscp.c +++ b/pscp.c @@ -118,7 +118,7 @@ void nonfatal(const char *fmt, ...) sfree(str2); errs++; } -void connection_fatal(void *frontend, const char *fmt, ...) +void connection_fatal(Frontend *frontend, const char *fmt, ...) { char *str, *str2; va_list ap; @@ -157,7 +157,8 @@ static unsigned char *outptr; /* where to put the data */ static unsigned outlen; /* how much data required */ static unsigned char *pending = NULL; /* any spare data */ static unsigned pendlen = 0, pendsize = 0; /* length and phys. size of buffer */ -int from_backend(void *frontend, int is_stderr, const void *data, int datalen) +int from_backend(Frontend *frontend, int is_stderr, + const void *data, int datalen) { unsigned char *p = (unsigned char *) data; unsigned len = (unsigned) datalen; @@ -195,7 +196,7 @@ int from_backend(void *frontend, int is_stderr, const void *data, int datalen) return 0; } -int from_backend_untrusted(void *frontend_handle, const void *data, int len) +int from_backend_untrusted(Frontend *frontend, const void *data, int len) { /* * No "untrusted" output should get here (the way the code is @@ -204,7 +205,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len) assert(!"Unexpected call to from_backend_untrusted()"); return 0; /* not reached */ } -int from_backend_eof(void *frontend) +int from_backend_eof(Frontend *frontend) { /* * We usually expect to be the party deciding when to close the diff --git a/psftp.c b/psftp.c index c2d23832..d57b118e 100644 --- a/psftp.c +++ b/psftp.c @@ -2466,7 +2466,7 @@ void nonfatal(const char *fmt, ...) fputs(str2, stderr); sfree(str2); } -void connection_fatal(void *frontend, const char *fmt, ...) +void connection_fatal(Frontend *frontend, const char *fmt, ...) { char *str, *str2; va_list ap; @@ -2506,7 +2506,8 @@ static unsigned char *outptr; /* where to put the data */ static unsigned outlen; /* how much data required */ static unsigned char *pending = NULL; /* any spare data */ static unsigned pendlen = 0, pendsize = 0; /* length and phys. size of buffer */ -int from_backend(void *frontend, int is_stderr, const void *data, int datalen) +int from_backend(Frontend *frontend, int is_stderr, + const void *data, int datalen) { unsigned char *p = (unsigned char *) data; unsigned len = (unsigned) datalen; @@ -2550,7 +2551,7 @@ int from_backend(void *frontend, int is_stderr, const void *data, int datalen) return 0; } -int from_backend_untrusted(void *frontend_handle, const void *data, int len) +int from_backend_untrusted(Frontend *frontend, const void *data, int len) { /* * No "untrusted" output should get here (the way the code is @@ -2559,7 +2560,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len) assert(!"Unexpected call to from_backend_untrusted()"); return 0; /* not reached */ } -int from_backend_eof(void *frontend) +int from_backend_eof(Frontend *frontend) { /* * We expect to be the party deciding when to close the diff --git a/putty.h b/putty.h index 2f53d645..1a8c30ce 100644 --- a/putty.h +++ b/putty.h @@ -445,7 +445,7 @@ struct Backend { const Backend_vtable *vt; }; struct Backend_vtable { - const char *(*init) (void *frontend_handle, Backend **backend_out, + const char *(*init) (Frontend *frontend, Backend **backend_out, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive); @@ -608,11 +608,11 @@ typedef struct { size_t n_prompts; /* May be zero (in which case display the foregoing, * if any, and return success) */ prompt_t **prompts; - void *frontend; + Frontend *frontend; void *data; /* slot for housekeeping data, managed by * get_userpass_input(); initially NULL */ } prompts_t; -prompts_t *new_prompts(void *frontend); +prompts_t *new_prompts(Frontend *frontend); void add_prompt(prompts_t *p, char *promptstr, int echo); void prompt_set_result(prompt_t *pr, const char *newstr); void prompt_ensure_result_size(prompt_t *pr, int len); @@ -673,7 +673,7 @@ enum { ALL_CLIPBOARDS(CLIP_ID) N_CLIPBOARDS }; /* * Exports from the front end. */ -void request_resize(void *frontend, int, int); +void request_resize(Frontend *frontend, int, int); void do_text(Context, int, int, wchar_t *, int, unsigned long, int, truecolour); void do_cursor(Context, int, int, wchar_t *, int, unsigned long, int, @@ -682,46 +682,46 @@ int char_width(Context ctx, int uc); #ifdef OPTIMISE_SCROLL void do_scroll(Context, int, int, int); #endif -void set_title(void *frontend, char *); -void set_icon(void *frontend, char *); -void set_sbar(void *frontend, int, int, int); -Context get_ctx(void *frontend); +void set_title(Frontend *frontend, char *); +void set_icon(Frontend *frontend, char *); +void set_sbar(Frontend *frontend, int, int, int); +Context get_ctx(Frontend *frontend); void free_ctx(Context); -void palette_set(void *frontend, int, int, int, int); -void palette_reset(void *frontend); -int palette_get(void *frontend, int n, int *r, int *g, int *b); -void write_clip(void *frontend, int clipboard, wchar_t *, int *, +void palette_set(Frontend *frontend, int, int, int, int); +void palette_reset(Frontend *frontend); +int palette_get(Frontend *frontend, int n, int *r, int *g, int *b); +void write_clip(Frontend *frontend, int clipboard, wchar_t *, int *, truecolour *, int, int); -void optimised_move(void *frontend, int, int, int); -void set_raw_mouse_mode(void *frontend, int); -void connection_fatal(void *frontend, const char *, ...); +void optimised_move(Frontend *frontend, int, int, int); +void set_raw_mouse_mode(Frontend *frontend, int); +void connection_fatal(Frontend *frontend, const char *, ...); void nonfatal(const char *, ...); void modalfatalbox(const char *, ...); #ifdef macintosh #pragma noreturn(modalfatalbox) #endif -void do_beep(void *frontend, int); -void begin_session(void *frontend); -void sys_cursor(void *frontend, int x, int y); -void frontend_request_paste(void *frontend, int clipboard); -void frontend_keypress(void *frontend); -void frontend_echoedit_update(void *frontend, int echo, int edit); +void do_beep(Frontend *frontend, int); +void begin_session(Frontend *frontend); +void sys_cursor(Frontend *frontend, int x, int y); +void frontend_request_paste(Frontend *frontend, int clipboard); +void frontend_keypress(Frontend *frontend); +void frontend_echoedit_update(Frontend *frontend, int echo, int edit); /* It's the backend's responsibility to invoke this at the start of a * connection, if necessary; it can also invoke it later if the set of * special commands changes. It does not need to invoke it at session * shutdown. */ -void update_specials_menu(void *frontend); -int from_backend(void *frontend, int is_stderr, const void *data, int len); -int from_backend_untrusted(void *frontend, const void *data, int len); +void update_specials_menu(Frontend *frontend); +int from_backend(Frontend *frontend, int is_stderr, const void *data, int len); +int from_backend_untrusted(Frontend *frontend, const void *data, int len); /* Called when the back end wants to indicate that EOF has arrived on * the server-to-client stream. Returns FALSE to indicate that we * intend to keep the session open in the other direction, or TRUE to * indicate that if they're closing so are we. */ -int from_backend_eof(void *frontend); -void notify_remote_exit(void *frontend); +int from_backend_eof(Frontend *frontend); +void notify_remote_exit(Frontend *frontend); /* Get a sensible value for a tty mode. NULL return = don't set. * Otherwise, returned value should be freed by caller. */ -char *get_ttymode(void *frontend, const char *mode); +char *get_ttymode(Frontend *frontend, const char *mode); /* * >0 = `got all results, carry on' * 0 = `user cancelled' (FIXME distinguish "give up entirely" and "next auth"?) @@ -730,15 +730,15 @@ char *get_ttymode(void *frontend, const char *mode); int get_userpass_input(prompts_t *p, bufchain *input); #define OPTIMISE_IS_SCROLL 1 -void set_iconic(void *frontend, int iconic); -void move_window(void *frontend, int x, int y); -void set_zorder(void *frontend, int top); -void refresh_window(void *frontend); -void set_zoomed(void *frontend, int zoomed); -int is_iconic(void *frontend); -void get_window_pos(void *frontend, int *x, int *y); -void get_window_pixels(void *frontend, int *x, int *y); -char *get_window_title(void *frontend, int icon); +void set_iconic(Frontend *frontend, int iconic); +void move_window(Frontend *frontend, int x, int y); +void set_zorder(Frontend *frontend, int top); +void refresh_window(Frontend *frontend); +void set_zoomed(Frontend *frontend, int zoomed); +int is_iconic(Frontend *frontend); +void get_window_pos(Frontend *frontend, int *x, int *y); +void get_window_pixels(Frontend *frontend, int *x, int *y); +char *get_window_title(Frontend *frontend, int icon); /* Hint from backend to frontend about time-consuming operations. * Initial state is assumed to be BUSY_NOT. */ enum { @@ -748,8 +748,8 @@ enum { stuff is suspended */ BUSY_CPU /* Locally busy (e.g. crypto); user interaction suspended */ }; -void set_busy_status(void *frontend, int status); -int frontend_is_utf8(void *frontend); +void set_busy_status(Frontend *frontend, int status); +int frontend_is_utf8(Frontend *frontend); void cleanup_exit(int); @@ -1105,7 +1105,7 @@ FontSpec *platform_default_fontspec(const char *name); * Exports from terminal.c. */ -Terminal *term_init(Conf *, struct unicode_data *, void *); +Terminal *term_init(Conf *, struct unicode_data *, Frontend *); void term_free(Terminal *); void term_size(Terminal *, int, int, int); void term_paint(Terminal *, Context, int, int, int, int, int); @@ -1142,7 +1142,7 @@ int format_arrow_key(char *buf, Terminal *term, int xkey, int ctrl); /* * Exports from logging.c. */ -LogContext *log_init(void *frontend, Conf *conf); +LogContext *log_init(Frontend *frontend, Conf *conf); void log_free(LogContext *logctx); void log_reconfig(LogContext *logctx, Conf *conf); void logfopen(LogContext *logctx); @@ -1196,7 +1196,7 @@ extern const struct Backend_vtable ssh_backend; /* * Exports from ldisc.c. */ -Ldisc *ldisc_create(Conf *, Terminal *, Backend *, void *); +Ldisc *ldisc_create(Conf *, Terminal *, Backend *, Frontend *); void ldisc_configure(Ldisc *, Conf *); void ldisc_free(Ldisc *); void ldisc_send(Ldisc *, const void *buf, int len, int interactive); @@ -1324,7 +1324,7 @@ int wc_unescape(char *output, const char *wildcard); /* * Exports from frontend (windlg.c etc) */ -void logevent(void *frontend, const char *); +void logevent(Frontend *frontend, const char *); void pgp_fingerprints(void); /* * verify_ssh_host_key() can return one of three values: @@ -1338,7 +1338,7 @@ void pgp_fingerprints(void); * back via the provided function with a result that's either 0 * or +1'. */ -int verify_ssh_host_key(void *frontend, char *host, int port, +int verify_ssh_host_key(Frontend *frontend, char *host, int port, const char *keytype, char *keystr, char *fingerprint, void (*callback)(void *ctx, int result), void *ctx); /* @@ -1354,9 +1354,9 @@ int have_ssh_host_key(const char *host, int port, const char *keytype); * warning threshold because that's all we have cached, but at least * one acceptable algorithm is available that we don't have cached.) */ -int askalg(void *frontend, const char *algtype, const char *algname, +int askalg(Frontend *frontend, const char *algtype, const char *algname, void (*callback)(void *ctx, int result), void *ctx); -int askhk(void *frontend, const char *algname, const char *betteralgs, +int askhk(Frontend *frontend, const char *algname, const char *betteralgs, void (*callback)(void *ctx, int result), void *ctx); /* * askappend can return four values: @@ -1366,7 +1366,7 @@ int askhk(void *frontend, const char *algname, const char *betteralgs, * - 0 means cancel logging for this session * - -1 means please wait. */ -int askappend(void *frontend, Filename *filename, +int askappend(Frontend *frontend, Filename *filename, void (*callback)(void *ctx, int result), void *ctx); /* @@ -1631,9 +1631,9 @@ struct IdempotentCallback { }; void queue_idempotent_callback(struct IdempotentCallback *ic); -typedef void (*toplevel_callback_notify_fn_t)(void *frontend); +typedef void (*toplevel_callback_notify_fn_t)(void *ctx); void request_callback_notifications(toplevel_callback_notify_fn_t notify, - void *frontend); + void *ctx); /* * Define no-op macros for the jump list functions, on platforms that diff --git a/raw.c b/raw.c index 56eb0385..df280139 100644 --- a/raw.c +++ b/raw.c @@ -14,7 +14,7 @@ typedef struct raw_backend_data { Socket s; int closed_on_socket_error; int bufsize; - void *frontend; + Frontend *frontend; int sent_console_eof, sent_socket_eof, session_started; Conf *conf; @@ -117,7 +117,7 @@ static const Plug_vtable Raw_plugvt = { * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ -static const char *raw_init(void *frontend_handle, Backend **backend_handle, +static const char *raw_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) @@ -139,7 +139,7 @@ static const char *raw_init(void *frontend_handle, Backend **backend_handle, raw->session_started = FALSE; raw->conf = conf_copy(conf); - raw->frontend = frontend_handle; + raw->frontend = frontend; addressfamily = conf_get_int(conf, CONF_addressfamily); /* diff --git a/rlogin.c b/rlogin.c index 978e3084..05dd7dbb 100644 --- a/rlogin.c +++ b/rlogin.c @@ -18,7 +18,7 @@ typedef struct rlogin_tag { int firstbyte; int cansize; int term_width, term_height; - void *frontend; + Frontend *frontend; Conf *conf; @@ -148,7 +148,7 @@ static const Plug_vtable Rlogin_plugvt = { * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ -static const char *rlogin_init(void *frontend_handle, Backend **backend_handle, +static const char *rlogin_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) @@ -165,7 +165,7 @@ static const char *rlogin_init(void *frontend_handle, Backend **backend_handle, rlogin->backend.vt = &rlogin_backend; rlogin->s = NULL; rlogin->closed_on_socket_error = FALSE; - rlogin->frontend = frontend_handle; + rlogin->frontend = frontend; rlogin->term_width = conf_get_int(conf, CONF_width); rlogin->term_height = conf_get_int(conf, CONF_height); rlogin->firstbyte = 1; diff --git a/ssh.c b/ssh.c index 952b901f..1009e038 100644 --- a/ssh.c +++ b/ssh.c @@ -729,7 +729,7 @@ struct ssh_tag { int echoing, editing; int session_started; - void *frontend; + Frontend *frontend; int ospeed, ispeed; /* temporaries */ int term_width, term_height; @@ -10665,7 +10665,7 @@ static void ssh_cache_conf_values(Ssh ssh) * * Returns an error message, or NULL on success. */ -static const char *ssh_init(void *frontend_handle, Backend **backend_handle, +static const char *ssh_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) @@ -10781,7 +10781,7 @@ static const char *ssh_init(void *frontend_handle, Backend **backend_handle, ssh->backend.vt = &ssh_backend; *backend_handle = &ssh->backend; - ssh->frontend = frontend_handle; + ssh->frontend = frontend; ssh->term_width = conf_get_int(ssh->conf, CONF_width); ssh->term_height = conf_get_int(ssh->conf, CONF_height); diff --git a/ssh.h b/ssh.h index 4529bbcc..3fe8266b 100644 --- a/ssh.h +++ b/ssh.h @@ -660,7 +660,7 @@ int random_byte(void); void random_add_noise(void *noise, int length); void random_add_heavynoise(void *noise, int length); -void logevent(void *, const char *); +void logevent(Frontend *, const char *); struct PortForwarding; diff --git a/telnet.c b/telnet.c index 673c152f..7e62e301 100644 --- a/telnet.c +++ b/telnet.c @@ -172,7 +172,7 @@ typedef struct telnet_tag { Socket s; int closed_on_socket_error; - void *frontend; + Frontend *frontend; Ldisc *ldisc; int term_width, term_height; @@ -705,7 +705,7 @@ static const Plug_vtable Telnet_plugvt = { * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ -static const char *telnet_init(void *frontend_handle, Backend **backend_handle, +static const char *telnet_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) { @@ -726,7 +726,7 @@ static const char *telnet_init(void *frontend_handle, Backend **backend_handle, telnet->activated = FALSE; telnet->sb_buf = NULL; telnet->sb_size = 0; - telnet->frontend = frontend_handle; + telnet->frontend = frontend; telnet->term_width = conf_get_int(telnet->conf, CONF_width); telnet->term_height = conf_get_int(telnet->conf, CONF_height); telnet->state = TOP_LEVEL; diff --git a/terminal.c b/terminal.c index 1dc83dc1..a8bd6fc7 100644 --- a/terminal.c +++ b/terminal.c @@ -1639,7 +1639,7 @@ const optionalrgb optionalrgb_none = {0, 0, 0, 0}; * Initialise the terminal. */ Terminal *term_init(Conf *myconf, struct unicode_data *ucsdata, - void *frontend) + Frontend *frontend) { Terminal *term; diff --git a/terminal.h b/terminal.h index 8ec256d4..f0727cf2 100644 --- a/terminal.h +++ b/terminal.h @@ -231,7 +231,7 @@ struct terminal_tag { Ldisc *ldisc; - void *frontend; + Frontend *frontend; LogContext *logctx; diff --git a/testback.c b/testback.c index f3e9e35f..01a7e6e0 100644 --- a/testback.c +++ b/testback.c @@ -32,9 +32,9 @@ #include "putty.h" -static const char *null_init(void *, Backend **, Conf *, const char *, int, +static const char *null_init(Frontend *, Backend **, Conf *, const char *, int, char **, int, int); -static const char *loop_init(void *, Backend **, Conf *, const char *, int, +static const char *loop_init(Frontend *, Backend **, Conf *, const char *, int, char **, int, int); static void null_free(Backend *); static void loop_free(Backend *); @@ -69,23 +69,23 @@ const struct Backend_vtable loop_backend = { }; struct loop_state { - Terminal *term; + Frontend *frontend; Backend backend; }; -static const char *null_init(void *frontend_handle, Backend **backend_handle, +static const char *null_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) { *backend_handle = NULL; return NULL; } -static const char *loop_init(void *frontend_handle, Backend **backend_handle, +static const char *loop_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) { struct loop_state *st = snew(struct loop_state); - st->term = frontend_handle; + st->frontend = frontend; *backend_handle = &st->backend; return NULL; } @@ -114,7 +114,7 @@ static int null_send(Backend *be, const char *buf, int len) { static int loop_send(Backend *be, const char *buf, int len) { struct loop_state *st = FROMFIELD(be, struct loop_state, backend); - return from_backend(st->term, 0, buf, len); + return from_backend(st->frontend, 0, buf, len); } static int null_sendbuffer(Backend *be) { diff --git a/unix/gtkapp.c b/unix/gtkapp.c index d520565d..f79e5e9a 100644 --- a/unix/gtkapp.c +++ b/unix/gtkapp.c @@ -99,7 +99,7 @@ int main(int argc, char **argv) fprintf(stderr, "GtkApplication frontend doesn't work pre-GTK3\n"); return 1; } -GtkWidget *make_gtk_toplevel_window(void *frontend) { return NULL; } +GtkWidget *make_gtk_toplevel_window(Frontend *frontend) { return NULL; } void launch_duplicate_session(Conf *conf) {} void launch_new_session(void) {} void launch_saved_session(const char *str) {} @@ -204,7 +204,7 @@ WIN_ACTION_LIST(WIN_ACTION_ENTRY) }; static GtkApplication *app; -GtkWidget *make_gtk_toplevel_window(void *frontend) +GtkWidget *make_gtk_toplevel_window(Frontend *frontend) { GtkWidget *win = gtk_application_window_new(app); g_action_map_add_action_entries(G_ACTION_MAP(win), diff --git a/unix/gtkcomm.c b/unix/gtkcomm.c index 9c3d1c53..6b6d19bb 100644 --- a/unix/gtkcomm.c +++ b/unix/gtkcomm.c @@ -221,7 +221,7 @@ static gint idle_toplevel_callback_func(gpointer data) return TRUE; } -static void notify_toplevel_callback(void *frontend) +static void notify_toplevel_callback(void *vctx) { if (!idle_fn_scheduled) { toplevel_callback_idle_id = diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 737163f2..f1425daf 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -3442,7 +3442,7 @@ struct verify_ssh_host_key_result_ctx { char *keystr; void (*callback)(void *callback_ctx, int result); void *callback_ctx; - void *frontend; + Frontend *frontend; }; static void verify_ssh_host_key_result_callback(void *vctx, int result) @@ -3483,7 +3483,7 @@ static void verify_ssh_host_key_result_callback(void *vctx, int result) sfree(ctx); } -int verify_ssh_host_key(void *frontend, char *host, int port, +int verify_ssh_host_key(Frontend *frontend, char *host, int port, const char *keytype, char *keystr, char *fingerprint, void (*callback)(void *ctx, int result), void *ctx) { @@ -3560,7 +3560,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port, struct simple_prompt_result_ctx { void (*callback)(void *callback_ctx, int result); void *callback_ctx; - void *frontend; + Frontend *frontend; enum DialogSlot dialog_slot; }; @@ -3584,7 +3584,7 @@ static void simple_prompt_result_callback(void *vctx, int result) * Ask whether the selected algorithm is acceptable (since it was * below the configured 'warn' threshold). */ -int askalg(void *frontend, const char *algtype, const char *algname, +int askalg(Frontend *frontend, const char *algtype, const char *algname, void (*callback)(void *ctx, int result), void *ctx) { static const char msg[] = @@ -3616,7 +3616,7 @@ int askalg(void *frontend, const char *algtype, const char *algname, return -1; /* dialog still in progress */ } -int askhk(void *frontend, const char *algname, const char *betteralgs, +int askhk(Frontend *frontend, const char *algname, const char *betteralgs, void (*callback)(void *ctx, int result), void *ctx) { static const char msg[] = @@ -4059,7 +4059,7 @@ void logevent_dlg(void *estuff, const char *string) } } -int askappend(void *frontend, Filename *filename, +int askappend(Frontend *frontend, Filename *filename, void (*callback)(void *ctx, int result), void *ctx) { static const char msgtemplate[] = diff --git a/unix/gtkmain.c b/unix/gtkmain.c index 906d029a..a97f7415 100644 --- a/unix/gtkmain.c +++ b/unix/gtkmain.c @@ -549,7 +549,7 @@ int do_cmdline(int argc, char **argv, int do_everything, Conf *conf) return err; } -GtkWidget *make_gtk_toplevel_window(void *frontend) +GtkWidget *make_gtk_toplevel_window(Frontend *frontend) { return gtk_window_new(GTK_WINDOW_TOPLEVEL); } diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 6867ac07..aebeff8f 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -76,7 +76,7 @@ struct clipboard_data_instance { #endif struct clipboard_state { - struct gui_data *inst; + Frontend *inst; int clipboard; GdkAtom atom; #ifdef JUST_USE_GTK_CLIPBOARD_UTF8 @@ -88,7 +88,7 @@ struct clipboard_state { #endif }; -struct gui_data { +struct Frontend { GtkWidget *window, *area, *sbar; gboolean sbar_visible; gboolean drawing_area_got_size, drawing_area_realised; @@ -182,7 +182,7 @@ struct gui_data { #endif }; -static void cache_conf_values(struct gui_data *inst) +static void cache_conf_values(Frontend *inst) { inst->bold_style = conf_get_int(inst->conf, CONF_bold_style); inst->window_border = conf_get_int(inst->conf, CONF_window_border); @@ -200,31 +200,31 @@ static void cache_conf_values(struct gui_data *inst) } struct draw_ctx { - struct gui_data *inst; + Frontend *inst; unifont_drawctx uctx; }; static int send_raw_mouse; -static void start_backend(struct gui_data *inst); +static void start_backend(Frontend *inst); static void exit_callback(void *vinst); -static void destroy_inst_connection(struct gui_data *inst); -static void delete_inst(struct gui_data *inst); +static void destroy_inst_connection(Frontend *inst); +static void delete_inst(Frontend *inst); static void post_fatal_message_box_toplevel(void *vctx) { - struct gui_data *inst = (struct gui_data *)vctx; + Frontend *inst = (Frontend *)vctx; gtk_widget_destroy(inst->window); } static void post_fatal_message_box(void *vctx, int result) { - struct gui_data *inst = (struct gui_data *)vctx; + Frontend *inst = (Frontend *)vctx; unregister_dialog(inst, DIALOG_SLOT_CONNECTION_FATAL); queue_toplevel_callback(post_fatal_message_box_toplevel, inst); } -void fatal_message_box(struct gui_data *inst, const char *msg) +void fatal_message_box(Frontend *inst, const char *msg) { char *title = dupcat(appname, " Fatal Error", NULL); GtkWidget *dialog = create_message_box( @@ -235,16 +235,14 @@ void fatal_message_box(struct gui_data *inst, const char *msg) sfree(title); } -static void connection_fatal_callback(void *vinst) +static void connection_fatal_callback(void *vctx) { - struct gui_data *inst = (struct gui_data *)vinst; + Frontend *inst = (Frontend *)vctx; destroy_inst_connection(inst); } -void connection_fatal(void *frontend, const char *p, ...) +void connection_fatal(Frontend *inst, const char *p, ...) { - struct gui_data *inst = (struct gui_data *)frontend; - va_list ap; char *msg; va_start(ap, p); @@ -254,7 +252,7 @@ void connection_fatal(void *frontend, const char *p, ...) sfree(msg); inst->exited = TRUE; /* suppress normal exit handling */ - queue_toplevel_callback(connection_fatal_callback, frontend); + queue_toplevel_callback(connection_fatal_callback, inst); } /* @@ -293,36 +291,33 @@ int platform_default_i(const char *name, int def) } /* Dummy routine, only required in plink. */ -void frontend_echoedit_update(void *frontend, int echo, int edit) +void frontend_echoedit_update(Frontend *inst, int echo, int edit) { } -char *get_ttymode(void *frontend, const char *mode) +char *get_ttymode(Frontend *inst, const char *mode) { - struct gui_data *inst = (struct gui_data *)frontend; return term_get_ttymode(inst->term, mode); } -int from_backend(void *frontend, int is_stderr, const void *data, int len) +int from_backend(Frontend *inst, int is_stderr, const void *data, int len) { - struct gui_data *inst = (struct gui_data *)frontend; return term_data(inst->term, is_stderr, data, len); } -int from_backend_untrusted(void *frontend, const void *data, int len) +int from_backend_untrusted(Frontend *inst, const void *data, int len) { - struct gui_data *inst = (struct gui_data *)frontend; return term_data_untrusted(inst->term, data, len); } -int from_backend_eof(void *frontend) +int from_backend_eof(Frontend *inst) { return TRUE; /* do respond to incoming EOF with outgoing */ } int get_userpass_input(prompts_t *p, bufchain *input) { - struct gui_data *inst = (struct gui_data *)p->frontend; + Frontend *inst = p->frontend; int ret; ret = cmdline_get_passwd_input(p); if (ret == -1) @@ -330,19 +325,15 @@ int get_userpass_input(prompts_t *p, bufchain *input) return ret; } -void logevent(void *frontend, const char *string) +void logevent(Frontend *inst, const char *string) { - struct gui_data *inst = (struct gui_data *)frontend; - log_eventlog(inst->logctx, string); logevent_dlg(inst->eventlogstuff, string); } -int font_dimension(void *frontend, int which)/* 0 for width, 1 for height */ +int font_dimension(Frontend *inst, int which) /* 0 for width, 1 for height */ { - struct gui_data *inst = (struct gui_data *)frontend; - if (which) return inst->font_height; else @@ -360,8 +351,6 @@ int font_dimension(void *frontend, int which)/* 0 for width, 1 for height */ */ static Mouse_Button translate_button(Mouse_Button button) { - /* struct gui_data *inst = (struct gui_data *)frontend; */ - if (button == MBT_LEFT) return MBT_SELECT; if (button == MBT_MIDDLE) @@ -375,9 +364,8 @@ static Mouse_Button translate_button(Mouse_Button button) * Return the top-level GtkWindow associated with a particular * front end instance. */ -GtkWidget *get_window(void *frontend) +GtkWidget *get_window(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)frontend; return inst->window; } @@ -386,16 +374,14 @@ GtkWidget *get_window(void *frontend) * network code wanting to ask an asynchronous user question (e.g. * 'what about this dodgy host key, then?'). */ -void register_dialog(void *frontend, enum DialogSlot slot, GtkWidget *dialog) +void register_dialog(Frontend *inst, enum DialogSlot slot, GtkWidget *dialog) { - struct gui_data *inst = (struct gui_data *)frontend; assert(slot < DIALOG_SLOT_LIMIT); assert(!inst->dialogs[slot]); inst->dialogs[slot] = dialog; } -void unregister_dialog(void *frontend, enum DialogSlot slot) +void unregister_dialog(Frontend *inst, enum DialogSlot slot) { - struct gui_data *inst = (struct gui_data *)frontend; assert(slot < DIALOG_SLOT_LIMIT); assert(inst->dialogs[slot]); inst->dialogs[slot] = NULL; @@ -405,13 +391,12 @@ void unregister_dialog(void *frontend, enum DialogSlot slot) * Minimise or restore the window in response to a server-side * request. */ -void set_iconic(void *frontend, int iconic) +void set_iconic(Frontend *inst, int iconic) { /* * GTK 1.2 doesn't know how to do this. */ #if GTK_CHECK_VERSION(2,0,0) - struct gui_data *inst = (struct gui_data *)frontend; if (iconic) gtk_window_iconify(GTK_WINDOW(inst->window)); else @@ -422,9 +407,8 @@ void set_iconic(void *frontend, int iconic) /* * Move the window in response to a server-side request. */ -void move_window(void *frontend, int x, int y) +void move_window(Frontend *inst, int x, int y) { - struct gui_data *inst = (struct gui_data *)frontend; /* * I assume that when the GTK version of this call is available * we should use it. Not sure how it differs from the GDK one, @@ -443,9 +427,8 @@ void move_window(void *frontend, int x, int y) * Move the window to the top or bottom of the z-order in response * to a server-side request. */ -void set_zorder(void *frontend, int top) +void set_zorder(Frontend *inst, int top) { - struct gui_data *inst = (struct gui_data *)frontend; if (top) gdk_window_raise(gtk_widget_get_window(inst->window)); else @@ -455,9 +438,8 @@ void set_zorder(void *frontend, int top) /* * Refresh the window in response to a server-side request. */ -void refresh_window(void *frontend) +void refresh_window(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)frontend; term_invalidate(inst->term); } @@ -465,13 +447,12 @@ void refresh_window(void *frontend) * Maximise or restore the window in response to a server-side * request. */ -void set_zoomed(void *frontend, int zoomed) +void set_zoomed(Frontend *inst, int zoomed) { /* * GTK 1.2 doesn't know how to do this. */ #if GTK_CHECK_VERSION(2,0,0) - struct gui_data *inst = (struct gui_data *)frontend; if (zoomed) gtk_window_maximize(GTK_WINDOW(inst->window)); else @@ -482,18 +463,16 @@ void set_zoomed(void *frontend, int zoomed) /* * Report whether the window is iconic, for terminal reports. */ -int is_iconic(void *frontend) +int is_iconic(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)frontend; return !gdk_window_is_viewable(gtk_widget_get_window(inst->window)); } /* * Report the window's position, for terminal reports. */ -void get_window_pos(void *frontend, int *x, int *y) +void get_window_pos(Frontend *inst, int *x, int *y) { - struct gui_data *inst = (struct gui_data *)frontend; /* * I assume that when the GTK version of this call is available * we should use it. Not sure how it differs from the GDK one, @@ -509,9 +488,8 @@ void get_window_pos(void *frontend, int *x, int *y) /* * Report the window's pixel size, for terminal reports. */ -void get_window_pixels(void *frontend, int *x, int *y) +void get_window_pixels(Frontend *inst, int *x, int *y) { - struct gui_data *inst = (struct gui_data *)frontend; /* * I assume that when the GTK version of this call is available * we should use it. Not sure how it differs from the GDK one, @@ -530,7 +508,7 @@ void get_window_pixels(void *frontend, int *x, int *y) * raise it, so that the user realises they've already been asked this * question. */ -static int find_and_raise_dialog(struct gui_data *inst, enum DialogSlot slot) +static int find_and_raise_dialog(Frontend *inst, enum DialogSlot slot) { GtkWidget *dialog = inst->dialogs[slot]; if (!dialog) @@ -546,15 +524,14 @@ static int find_and_raise_dialog(struct gui_data *inst, enum DialogSlot slot) /* * Return the window or icon title. */ -char *get_window_title(void *frontend, int icon) +char *get_window_title(Frontend *inst, int icon) { - struct gui_data *inst = (struct gui_data *)frontend; return icon ? inst->icontitle : inst->wintitle; } static void warn_on_close_callback(void *vctx, int result) { - struct gui_data *inst = (struct gui_data *)vctx; + Frontend *inst = (Frontend *)vctx; unregister_dialog(inst, DIALOG_SLOT_WARN_ON_CLOSE); if (result) gtk_widget_destroy(inst->window); @@ -570,9 +547,8 @@ static void warn_on_close_callback(void *vctx, int result) * handler need not do anything', i.e. 'suppress default handler', * i.e. 'do not close the window'.) */ -gint delete_window(GtkWidget *widget, GdkEvent *event, gpointer data) +gint delete_window(GtkWidget *widget, GdkEvent *event, Frontend *inst) { - struct gui_data *inst = (struct gui_data *)data; if (!inst->exited && conf_get_int(inst->conf, CONF_warn_on_close)) { /* * We're not going to exit right now. We must put up a @@ -594,7 +570,7 @@ gint delete_window(GtkWidget *widget, GdkEvent *event, gpointer data) return FALSE; } -static void update_mouseptr(struct gui_data *inst) +static void update_mouseptr(Frontend *inst) { switch (inst->busy_status) { case BUSY_NOT: @@ -620,7 +596,7 @@ static void update_mouseptr(struct gui_data *inst) } } -static void show_mouseptr(struct gui_data *inst, int show) +static void show_mouseptr(Frontend *inst, int show) { if (!conf_get_int(inst->conf, CONF_hide_mouseptr)) show = 1; @@ -628,9 +604,9 @@ static void show_mouseptr(struct gui_data *inst, int show) update_mouseptr(inst); } -static void draw_backing_rect(struct gui_data *inst); +static void draw_backing_rect(Frontend *inst); -static void drawing_area_setup(struct gui_data *inst, int width, int height) +static void drawing_area_setup(Frontend *inst, int width, int height) { int w, h, new_scale, need_size = 0; @@ -719,7 +695,7 @@ static void drawing_area_setup(struct gui_data *inst, int width, int height) #endif } -static void drawing_area_setup_simple(struct gui_data *inst) +static void drawing_area_setup_simple(Frontend *inst) { /* * Wrapper on drawing_area_setup which fetches the width and @@ -736,10 +712,8 @@ static void drawing_area_setup_simple(struct gui_data *inst) drawing_area_setup(inst, alloc.width, alloc.height); } -static void area_realised(GtkWidget *widget, gpointer data) +static void area_realised(GtkWidget *widget, Frontend *inst) { - struct gui_data *inst = (struct gui_data *)data; - inst->drawing_area_realised = TRUE; if (inst->drawing_area_realised && inst->drawing_area_got_size && inst->drawing_area_setup_needed) @@ -747,17 +721,15 @@ static void area_realised(GtkWidget *widget, gpointer data) } static void area_size_allocate( - GtkWidget *widget, GdkRectangle *alloc, gpointer data) + GtkWidget *widget, GdkRectangle *alloc, Frontend *inst) { - struct gui_data *inst = (struct gui_data *)data; - inst->drawing_area_got_size = TRUE; if (inst->drawing_area_realised && inst->drawing_area_got_size) drawing_area_setup(inst, alloc->width, alloc->height); } #if GTK_CHECK_VERSION(3,10,0) -static void area_check_scale(struct gui_data *inst) +static void area_check_scale(Frontend *inst) { if (!inst->drawing_area_setup_needed && inst->scale != gtk_widget_get_scale_factor(inst->area)) { @@ -774,7 +746,7 @@ static void area_check_scale(struct gui_data *inst) static gboolean area_configured( GtkWidget *widget, GdkEventConfigure *event, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; area_check_scale(inst); return FALSE; } @@ -799,7 +771,7 @@ static void cairo_setup_dctx(struct draw_ctx *dctx) #if GTK_CHECK_VERSION(3,0,0) static gint draw_area(GtkWidget *widget, cairo_t *cr, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; #if GTK_CHECK_VERSION(3,10,0) /* @@ -862,7 +834,7 @@ static gint draw_area(GtkWidget *widget, cairo_t *cr, gpointer data) #else gint expose_area(GtkWidget *widget, GdkEventExpose *event, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; #ifndef NO_BACKING_PIXMAPS /* @@ -912,11 +884,11 @@ char *dup_keyval_name(guint keyval) } #endif -static void change_font_size(struct gui_data *inst, int increment); +static void change_font_size(Frontend *inst, int increment); gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; char output[256]; wchar_t ucsoutput[2]; int ucsval, start, end, special, output_charset, use_ucsoutput; @@ -2146,7 +2118,7 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) #if GTK_CHECK_VERSION(2,0,0) void input_method_commit_event(GtkIMContext *imc, gchar *str, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; #ifdef KEY_EVENT_DIAGNOSTICS char *string_string = dupstr(""); @@ -2173,7 +2145,7 @@ void input_method_commit_event(GtkIMContext *imc, gchar *str, gpointer data) #define SCROLL_INCREMENT_LINES 5 #if GTK_CHECK_VERSION(3,4,0) -gboolean scroll_internal(struct gui_data *inst, gdouble delta, guint state, +gboolean scroll_internal(Frontend *inst, gdouble delta, guint state, gdouble ex, gdouble ey) { int shift, ctrl, alt, x, y, raw_mouse_mode; @@ -2225,7 +2197,7 @@ gboolean scroll_internal(struct gui_data *inst, gdouble delta, guint state, } #endif -static gboolean button_internal(struct gui_data *inst, GdkEventButton *event) +static gboolean button_internal(Frontend *inst, GdkEventButton *event) { int shift, ctrl, alt, x, y, button, act, raw_mouse_mode; @@ -2298,7 +2270,7 @@ static gboolean button_internal(struct gui_data *inst, GdkEventButton *event) gboolean button_event(GtkWidget *widget, GdkEventButton *event, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; return button_internal(inst, event); } @@ -2310,7 +2282,7 @@ gboolean button_event(GtkWidget *widget, GdkEventButton *event, gpointer data) */ gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; #if GTK_CHECK_VERSION(3,4,0) gdouble dx, dy; @@ -2351,7 +2323,7 @@ gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) gint motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; int shift, ctrl, alt, x, y, button; /* Remember the timestamp. */ @@ -2380,10 +2352,8 @@ gint motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) return TRUE; } -void frontend_keypress(void *handle) +void frontend_keypress(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)handle; - /* * If our child process has exited but not closed, terminate on * any keypress. @@ -2392,9 +2362,9 @@ void frontend_keypress(void *handle) gtk_widget_destroy(inst->window); } -static void exit_callback(void *vinst) +static void exit_callback(void *vctx) { - struct gui_data *inst = (struct gui_data *)vinst; + Frontend *inst = (Frontend *)vctx; int exitcode, close_on_exit; if (!inst->exited && @@ -2409,14 +2379,12 @@ static void exit_callback(void *vinst) } } -void notify_remote_exit(void *frontend) +void notify_remote_exit(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)frontend; - queue_toplevel_callback(exit_callback, inst); } -static void destroy_inst_connection(struct gui_data *inst) +static void destroy_inst_connection(Frontend *inst) { inst->exited = TRUE; if (inst->ldisc) { @@ -2435,7 +2403,7 @@ static void destroy_inst_connection(struct gui_data *inst) } } -static void delete_inst(struct gui_data *inst) +static void delete_inst(Frontend *inst) { int dialog_slot; for (dialog_slot = 0; dialog_slot < DIALOG_SLOT_LIMIT; dialog_slot++) { @@ -2496,7 +2464,7 @@ static void delete_inst(struct gui_data *inst) void destroy(GtkWidget *widget, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; inst->window = NULL; delete_inst(inst); session_window_closed(); @@ -2504,16 +2472,15 @@ void destroy(GtkWidget *widget, gpointer data) gint focus_event(GtkWidget *widget, GdkEventFocus *event, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; term_set_focus(inst->term, event->in); term_update(inst->term); show_mouseptr(inst, 1); return FALSE; } -void set_busy_status(void *frontend, int status) +void set_busy_status(Frontend *inst, int status) { - struct gui_data *inst = (struct gui_data *)frontend; inst->busy_status = status; update_mouseptr(inst); } @@ -2521,24 +2488,21 @@ void set_busy_status(void *frontend, int status) /* * set or clear the "raw mouse message" mode */ -void set_raw_mouse_mode(void *frontend, int activate) +void set_raw_mouse_mode(Frontend *inst, int activate) { - struct gui_data *inst = (struct gui_data *)frontend; activate = activate && !conf_get_int(inst->conf, CONF_no_mouse_rep); send_raw_mouse = activate; update_mouseptr(inst); } #if GTK_CHECK_VERSION(2,0,0) -static void compute_whole_window_size(struct gui_data *inst, +static void compute_whole_window_size(Frontend *inst, int wchars, int hchars, int *wpix, int *hpix); #endif -void request_resize(void *frontend, int w, int h) +void request_resize(Frontend *inst, int w, int h) { - struct gui_data *inst = (struct gui_data *)frontend; - #if !GTK_CHECK_VERSION(3,0,0) int large_x, large_y; @@ -2624,7 +2588,7 @@ void request_resize(void *frontend, int w, int h) } -static void real_palette_set(struct gui_data *inst, int n, int r, int g, int b) +static void real_palette_set(Frontend *inst, int n, int r, int g, int b) { inst->cols[n].red = r * 0x0101; inst->cols[n].green = g * 0x0101; @@ -2678,7 +2642,7 @@ void set_gtk_widget_background(GtkWidget *widget, const GdkColor *col) #endif } -void set_window_background(struct gui_data *inst) +void set_window_background(Frontend *inst) { if (inst->area) set_gtk_widget_background(GTK_WIDGET(inst->area), &inst->cols[258]); @@ -2686,9 +2650,8 @@ void set_window_background(struct gui_data *inst) set_gtk_widget_background(GTK_WIDGET(inst->window), &inst->cols[258]); } -void palette_set(void *frontend, int n, int r, int g, int b) +void palette_set(Frontend *inst, int n, int r, int g, int b) { - struct gui_data *inst = (struct gui_data *)frontend; if (n >= 16) n += 256 - 16; if (n >= NALLCOLOURS) @@ -2703,9 +2666,8 @@ void palette_set(void *frontend, int n, int r, int g, int b) } } -int palette_get(void *frontend, int n, int *r, int *g, int *b) +int palette_get(Frontend *inst, int n, int *r, int *g, int *b) { - struct gui_data *inst = (struct gui_data *)frontend; if (n < 0 || n >= NALLCOLOURS) return FALSE; *r = inst->cols[n].red >> 8; @@ -2714,9 +2676,8 @@ int palette_get(void *frontend, int n, int *r, int *g, int *b) return TRUE; } -void palette_reset(void *frontend) +void palette_reset(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)frontend; /* This maps colour indices in inst->conf to those used in inst->cols. */ static const int ww[] = { 256, 257, 258, 259, 260, 261, @@ -2784,7 +2745,7 @@ void palette_reset(void *frontend) } static struct clipboard_state *clipboard_from_atom( - struct gui_data *inst, GdkAtom atom) + Frontend *inst, GdkAtom atom) { int i; @@ -2806,7 +2767,7 @@ static struct clipboard_state *clipboard_from_atom( * formats it feels like. */ -void set_clipboard_atom(struct gui_data *inst, int clipboard, GdkAtom atom) +void set_clipboard_atom(Frontend *inst, int clipboard, GdkAtom atom) { struct clipboard_state *state = &inst->clipstates[clipboard]; @@ -2823,7 +2784,7 @@ void set_clipboard_atom(struct gui_data *inst, int clipboard, GdkAtom atom) } } -int init_clipboard(struct gui_data *inst) +int init_clipboard(Frontend *inst) { set_clipboard_atom(inst, CLIP_PRIMARY, GDK_SELECTION_PRIMARY); set_clipboard_atom(inst, CLIP_CLIPBOARD, clipboard_atom); @@ -2861,11 +2822,10 @@ static void clipboard_clear(GtkClipboard *clipboard, gpointer data) sfree(cdi); } -void write_clip(void *frontend, int clipboard, +void write_clip(Frontend *inst, int clipboard, wchar_t *data, int *attr, truecolour *truecolour, int len, int must_deselect) { - struct gui_data *inst = (struct gui_data *)frontend; struct clipboard_state *state = &inst->clipstates[clipboard]; struct clipboard_data_instance *cdi; @@ -2922,7 +2882,7 @@ void write_clip(void *frontend, int clipboard, static void clipboard_text_received(GtkClipboard *clipboard, const gchar *text, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; wchar_t *paste; int paste_len; int length; @@ -2940,9 +2900,8 @@ static void clipboard_text_received(GtkClipboard *clipboard, sfree(paste); } -void frontend_request_paste(void *frontend, int clipboard) +void frontend_request_paste(Frontend *inst, int clipboard) { - struct gui_data *inst = (struct gui_data *)frontend; struct clipboard_state *state = &inst->clipstates[clipboard]; if (!state->gtkclipboard) @@ -2975,7 +2934,7 @@ void frontend_request_paste(void *frontend, int clipboard) */ /* Store the data in a cut-buffer. */ -static void store_cutbuffer(struct gui_data *inst, char *ptr, int len) +static void store_cutbuffer(Frontend *inst, char *ptr, int len) { #ifndef NOT_X_WINDOWS if (inst->disp) { @@ -2989,7 +2948,7 @@ static void store_cutbuffer(struct gui_data *inst, char *ptr, int len) /* Retrieve data from a cut-buffer. * Returned data needs to be freed with XFree(). */ -static char *retrieve_cutbuffer(struct gui_data *inst, int *nbytes) +static char *retrieve_cutbuffer(Frontend *inst, int *nbytes) { #ifndef NOT_X_WINDOWS char *ptr; @@ -3009,11 +2968,10 @@ static char *retrieve_cutbuffer(struct gui_data *inst, int *nbytes) #endif } -void write_clip(void *frontend, int clipboard, +void write_clip(Frontend *inst, int clipboard, wchar_t *data, int *attr, truecolour *truecolour, int len, int must_deselect) { - struct gui_data *inst = (struct gui_data *)frontend; struct clipboard_state *state = &inst->clipstates[clipboard]; if (state->pasteout_data) @@ -3115,7 +3073,7 @@ void write_clip(void *frontend, int clipboard, static void selection_get(GtkWidget *widget, GtkSelectionData *seldata, guint info, guint time_stamp, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; GdkAtom target = gtk_selection_data_get_target(seldata); struct clipboard_state *state = clipboard_from_atom( inst, gtk_selection_data_get_selection(seldata)); @@ -3140,7 +3098,7 @@ static void selection_get(GtkWidget *widget, GtkSelectionData *seldata, static gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; struct clipboard_state *state = clipboard_from_atom( inst, seldata->selection); @@ -3163,9 +3121,8 @@ static gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata, return TRUE; } -void frontend_request_paste(void *frontend, int clipboard) +void frontend_request_paste(Frontend *inst, int clipboard) { - struct gui_data *inst = (struct gui_data *)frontend; struct clipboard_state *state = &inst->clipstates[clipboard]; /* @@ -3198,7 +3155,7 @@ void frontend_request_paste(void *frontend, int clipboard) static void selection_received(GtkWidget *widget, GtkSelectionData *seldata, guint time, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; char *text; int length; #ifndef NOT_X_WINDOWS @@ -3320,7 +3277,7 @@ static void selection_received(GtkWidget *widget, GtkSelectionData *seldata, #endif } -static void init_one_clipboard(struct gui_data *inst, int clipboard) +static void init_one_clipboard(Frontend *inst, int clipboard) { struct clipboard_state *state = &inst->clipstates[clipboard]; @@ -3328,7 +3285,7 @@ static void init_one_clipboard(struct gui_data *inst, int clipboard) state->clipboard = clipboard; } -void set_clipboard_atom(struct gui_data *inst, int clipboard, GdkAtom atom) +void set_clipboard_atom(Frontend *inst, int clipboard, GdkAtom atom) { struct clipboard_state *state = &inst->clipstates[clipboard]; @@ -3338,7 +3295,7 @@ void set_clipboard_atom(struct gui_data *inst, int clipboard, GdkAtom atom) state->atom = atom; } -void init_clipboard(struct gui_data *inst) +void init_clipboard(Frontend *inst) { #ifndef NOT_X_WINDOWS /* @@ -3394,7 +3351,7 @@ void init_clipboard(struct gui_data *inst) #endif /* JUST_USE_GTK_CLIPBOARD_UTF8 */ -static void set_window_titles(struct gui_data *inst) +static void set_window_titles(Frontend *inst) { /* * We must always call set_icon_name after calling set_title, @@ -3407,25 +3364,22 @@ static void set_window_titles(struct gui_data *inst) inst->icontitle); } -void set_title(void *frontend, char *title) +void set_title(Frontend *inst, char *title) { - struct gui_data *inst = (struct gui_data *)frontend; sfree(inst->wintitle); inst->wintitle = dupstr(title); set_window_titles(inst); } -void set_icon(void *frontend, char *title) +void set_icon(Frontend *inst, char *title) { - struct gui_data *inst = (struct gui_data *)frontend; sfree(inst->icontitle); inst->icontitle = dupstr(title); set_window_titles(inst); } -void set_title_and_icon(void *frontend, char *title, char *icon) +void set_title_and_icon(Frontend *inst, char *title, char *icon) { - struct gui_data *inst = (struct gui_data *)frontend; sfree(inst->wintitle); inst->wintitle = dupstr(title); sfree(inst->icontitle); @@ -3433,9 +3387,8 @@ void set_title_and_icon(void *frontend, char *title, char *icon) set_window_titles(inst); } -void set_sbar(void *frontend, int total, int start, int page) +void set_sbar(Frontend *inst, int total, int start, int page) { - struct gui_data *inst = (struct gui_data *)frontend; if (!conf_get_int(inst->conf, CONF_scrollbar)) return; inst->ignore_sbar = TRUE; @@ -3451,17 +3404,15 @@ void set_sbar(void *frontend, int total, int start, int page) inst->ignore_sbar = FALSE; } -void scrollbar_moved(GtkAdjustment *adj, gpointer data) +void scrollbar_moved(GtkAdjustment *adj, Frontend *inst) { - struct gui_data *inst = (struct gui_data *)data; - if (!conf_get_int(inst->conf, CONF_scrollbar)) return; if (!inst->ignore_sbar) term_scroll(inst->term, 1, (int)gtk_adjustment_get_value(adj)); } -static void show_scrollbar(struct gui_data *inst, gboolean visible) +static void show_scrollbar(Frontend *inst, gboolean visible) { inst->sbar_visible = visible; if (visible) @@ -3470,7 +3421,7 @@ static void show_scrollbar(struct gui_data *inst, gboolean visible) gtk_widget_hide(inst->sbar); } -void sys_cursor(void *frontend, int x, int y) +void sys_cursor(Frontend *frontend, int x, int y) { /* * This is meaningless under X. @@ -3483,7 +3434,7 @@ void sys_cursor(void *frontend, int x, int y) * may want to perform additional actions on any kind of bell (for * example, taskbar flashing in Windows). */ -void do_beep(void *frontend, int mode) +void do_beep(Frontend *frontend, int mode) { if (mode == BELL_DEFAULT) gdk_display_beep(gdk_display_get_default()); @@ -3498,9 +3449,8 @@ int char_width(Context ctx, int uc) return 1; } -Context get_ctx(void *frontend) +Context get_ctx(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)frontend; struct draw_ctx *dctx; if (!gtk_widget_get_window(inst->area)) @@ -3534,7 +3484,7 @@ Context get_ctx(void *frontend) void free_ctx(Context ctx) { struct draw_ctx *dctx = (struct draw_ctx *)ctx; - /* struct gui_data *inst = dctx->inst; */ + /* Frontend *inst = dctx->inst; */ #ifdef DRAW_TEXT_GDK if (dctx->uctx.type == DRAWTYPE_GDK) { gdk_gc_unref(dctx->uctx.u.gdk.gc); @@ -3824,7 +3774,7 @@ static void draw_stretch_after(struct draw_ctx *dctx, int x, int y, #endif } -static void draw_backing_rect(struct gui_data *inst) +static void draw_backing_rect(Frontend *inst) { int w, h; struct draw_ctx *dctx = get_ctx(inst); @@ -3850,7 +3800,7 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len, unsigned long attr, int lattr, truecolour truecolour) { struct draw_ctx *dctx = (struct draw_ctx *)ctx; - struct gui_data *inst = dctx->inst; + Frontend *inst = dctx->inst; int ncombining; int nfg, nbg, t, fontid, shadow, rlen, widefactor, bold; int monochrome = @@ -4007,7 +3957,7 @@ void do_text(Context ctx, int x, int y, wchar_t *text, int len, unsigned long attr, int lattr, truecolour truecolour) { struct draw_ctx *dctx = (struct draw_ctx *)ctx; - struct gui_data *inst = dctx->inst; + Frontend *inst = dctx->inst; int widefactor; do_text_internal(ctx, x, y, text, len, attr, lattr, truecolour); @@ -4037,7 +3987,7 @@ void do_cursor(Context ctx, int x, int y, wchar_t *text, int len, unsigned long attr, int lattr, truecolour truecolour) { struct draw_ctx *dctx = (struct draw_ctx *)ctx; - struct gui_data *inst = dctx->inst; + Frontend *inst = dctx->inst; int active, passive, widefactor; @@ -4149,7 +4099,7 @@ void do_cursor(Context ctx, int x, int y, wchar_t *text, int len, #endif } -GdkCursor *make_mouse_ptr(struct gui_data *inst, int cursor_val) +GdkCursor *make_mouse_ptr(Frontend *inst, int cursor_val) { if (cursor_val == -1) { #if GTK_CHECK_VERSION(2,16,0) @@ -4186,15 +4136,14 @@ void modalfatalbox(const char *p, ...) exit(1); } -const char *get_x_display(void *frontend) +const char *get_x_display(Frontend *frontend) { return gdk_get_display(); } #ifndef NOT_X_WINDOWS -int get_windowid(void *frontend, long *id) +int get_windowid(Frontend *inst, long *id) { - struct gui_data *inst = (struct gui_data *)frontend; GdkWindow *window = gtk_widget_get_window(inst->area); if (!GDK_IS_X11_WINDOW(window)) return FALSE; @@ -4203,13 +4152,12 @@ int get_windowid(void *frontend, long *id) } #endif -int frontend_is_utf8(void *frontend) +int frontend_is_utf8(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)frontend; return inst->ucsdata.line_codepage == CS_UTF8; } -char *setup_fonts_ucs(struct gui_data *inst) +char *setup_fonts_ucs(Frontend *inst) { int shadowbold = conf_get_int(inst->conf, CONF_shadowbold); int shadowboldoffset = conf_get_int(inst->conf, CONF_shadowboldoffset); @@ -4312,7 +4260,7 @@ static void find_app_menu_bar(GtkWidget *widget, gpointer data) } #endif -static void compute_geom_hints(struct gui_data *inst, GdkGeometry *geom) +static void compute_geom_hints(Frontend *inst, GdkGeometry *geom) { /* * Unused fields in geom. @@ -4413,7 +4361,7 @@ static void compute_geom_hints(struct gui_data *inst, GdkGeometry *geom) #endif } -void set_geom_hints(struct gui_data *inst) +void set_geom_hints(Frontend *inst) { GdkGeometry geom; gint flags = GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE | GDK_HINT_RESIZE_INC; @@ -4427,7 +4375,7 @@ void set_geom_hints(struct gui_data *inst) } #if GTK_CHECK_VERSION(2,0,0) -static void compute_whole_window_size(struct gui_data *inst, +static void compute_whole_window_size(Frontend *inst, int wchars, int hchars, int *wpix, int *hpix) { @@ -4440,13 +4388,13 @@ static void compute_whole_window_size(struct gui_data *inst, void clear_scrollback_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; term_clrsb(inst->term); } void reset_terminal_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; term_pwron(inst->term, TRUE); if (inst->ldisc) ldisc_echoedit_update(inst->ldisc); @@ -4454,27 +4402,27 @@ void reset_terminal_menuitem(GtkMenuItem *item, gpointer data) void copy_clipboard_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; static const int clips[] = { MENU_CLIPBOARD }; term_request_copy(inst->term, clips, lenof(clips)); } void paste_clipboard_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; term_request_paste(inst->term, MENU_CLIPBOARD); } void copy_all_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; static const int clips[] = { COPYALL_CLIPBOARDS }; term_copyall(inst->term, clips, lenof(clips)); } void special_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; int code = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), "user-data")); @@ -4484,17 +4432,17 @@ void special_menuitem(GtkMenuItem *item, gpointer data) void about_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; about_box(inst->window); } void event_log_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; showeventlog(inst->eventlogstuff, inst->window); } -void setup_clipboards(struct gui_data *inst, Terminal *term, Conf *conf) +void setup_clipboards(Frontend *inst, Terminal *term, Conf *conf) { assert(term->mouse_select_clipboards[0] == CLIP_LOCAL); @@ -4556,7 +4504,7 @@ void setup_clipboards(struct gui_data *inst, Terminal *term, Conf *conf) } struct after_change_settings_dialog_ctx { - struct gui_data *inst; + Frontend *inst; Conf *newconf; }; @@ -4564,7 +4512,7 @@ static void after_change_settings_dialog(void *vctx, int retval); void change_settings_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; struct after_change_settings_dialog_ctx *ctx; GtkWidget *dialog; char *title; @@ -4597,7 +4545,7 @@ static void after_change_settings_dialog(void *vctx, int retval) }; struct after_change_settings_dialog_ctx ctx = *(struct after_change_settings_dialog_ctx *)vctx; - struct gui_data *inst = ctx.inst; + Frontend *inst = ctx.inst; Conf *oldconf = inst->conf, *newconf = ctx.newconf; int i, j, need_size; @@ -4772,7 +4720,7 @@ static void after_change_settings_dialog(void *vctx, int retval) } } -static void change_font_size(struct gui_data *inst, int increment) +static void change_font_size(Frontend *inst, int increment) { static const int conf_keys[lenof(inst->fonts)] = { CONF_font, CONF_boldfont, CONF_widefont, CONF_wideboldfont, @@ -4835,7 +4783,7 @@ static void change_font_size(struct gui_data *inst, int increment) void dup_session_menuitem(GtkMenuItem *item, gpointer gdata) { - struct gui_data *inst = (struct gui_data *)gdata; + Frontend *inst = (Frontend *)gdata; launch_duplicate_session(inst->conf); } @@ -4847,7 +4795,7 @@ void new_session_menuitem(GtkMenuItem *item, gpointer data) void restart_session_menuitem(GtkMenuItem *item, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; if (!inst->backend) { logevent(inst, "----- Session restarted -----"); @@ -4871,9 +4819,9 @@ void saved_session_freedata(GtkMenuItem *item, gpointer data) sfree(str); } -void app_menu_action(void *frontend, enum MenuAction action) +void app_menu_action(Frontend *frontend, enum MenuAction action) { - struct gui_data *inst = (struct gui_data *)frontend; + Frontend *inst = (Frontend *)frontend; switch (action) { case MA_COPY: copy_clipboard_menuitem(NULL, inst); @@ -4907,7 +4855,7 @@ void app_menu_action(void *frontend, enum MenuAction action) static void update_savedsess_menu(GtkMenuItem *menuitem, gpointer data) { - struct gui_data *inst = (struct gui_data *)data; + Frontend *inst = (Frontend *)data; struct sesslist sesslist; int i; @@ -4976,10 +4924,8 @@ void set_window_icon(GtkWidget *window, const char *const *const *icon, #endif } -void update_specials_menu(void *frontend) +void update_specials_menu(Frontend *inst) { - struct gui_data *inst = (struct gui_data *)frontend; - const struct telnet_special *specials; if (inst->backend) @@ -5041,7 +4987,7 @@ void update_specials_menu(void *frontend) } } -static void start_backend(struct gui_data *inst) +static void start_backend(Frontend *inst) { const struct Backend_vtable *vt; char *realhost; @@ -5114,14 +5060,14 @@ static void get_monitor_geometry(GtkWidget *widget, GdkRectangle *geometry) void new_session_window(Conf *conf, const char *geometry_string) { - struct gui_data *inst; + Frontend *inst; prepare_session(conf); /* * Create an instance structure and initialise to zeroes */ - inst = snew(struct gui_data); + inst = snew(Frontend); memset(inst, 0, sizeof(*inst)); #ifdef JUST_USE_GTK_CLIPBOARD_UTF8 inst->cdi_headtail.next = inst->cdi_headtail.prev = &inst->cdi_headtail; diff --git a/unix/unix.h b/unix/unix.h index f9ff3c68..3dd2864a 100644 --- a/unix/unix.h +++ b/unix/unix.h @@ -175,7 +175,7 @@ void launch_saved_session(const char *str); void session_window_closed(void); void window_setup_error(const char *errmsg); #ifdef MAY_REFER_TO_GTK_IN_HEADERS -GtkWidget *make_gtk_toplevel_window(void *frontend); +GtkWidget *make_gtk_toplevel_window(Frontend *frontend); #endif const struct Backend_vtable *select_backend(Conf *conf); @@ -189,16 +189,16 @@ enum MenuAction { MA_RESTART_SESSION, MA_CHANGE_SETTINGS, MA_CLEAR_SCROLLBACK, MA_RESET_TERMINAL, MA_EVENT_LOG }; -void app_menu_action(void *frontend, enum MenuAction); +void app_menu_action(Frontend *frontend, enum MenuAction); /* Things pty.c needs from pterm.c */ -const char *get_x_display(void *frontend); -int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */ -int get_windowid(void *frontend, long *id); +const char *get_x_display(Frontend *frontend); +int font_dimension(Frontend *frontend, int which);/* 0 for width, 1 for height */ +int get_windowid(Frontend *frontend, long *id); /* Things gtkdlg.c needs from pterm.c */ #ifdef MAY_REFER_TO_GTK_IN_HEADERS -GtkWidget *get_window(void *frontend); +GtkWidget *get_window(Frontend *frontend); enum DialogSlot { DIALOG_SLOT_RECONFIGURE, DIALOG_SLOT_NETWORK_PROMPT, @@ -207,8 +207,8 @@ enum DialogSlot { DIALOG_SLOT_CONNECTION_FATAL, DIALOG_SLOT_LIMIT /* must remain last */ }; -void register_dialog(void *frontend, enum DialogSlot slot, GtkWidget *dialog); -void unregister_dialog(void *frontend, enum DialogSlot slot); +void register_dialog(Frontend *frontend, enum DialogSlot slot, GtkWidget *dialog); +void unregister_dialog(Frontend *frontend, enum DialogSlot slot); #endif /* Things pterm.c needs from gtkdlg.c */ diff --git a/unix/uxcons.c b/unix/uxcons.c index e7f531dc..b4fecce1 100644 --- a/unix/uxcons.c +++ b/unix/uxcons.c @@ -63,15 +63,15 @@ void cleanup_exit(int code) exit(code); } -void set_busy_status(void *frontend, int status) +void set_busy_status(Frontend *frontend, int status) { } -void update_specials_menu(void *frontend) +void update_specials_menu(Frontend *frontend) { } -void notify_remote_exit(void *frontend) +void notify_remote_exit(Frontend *frontend) { } @@ -113,7 +113,7 @@ static int block_and_read(int fd, void *buf, size_t len) return ret; } -int verify_ssh_host_key(void *frontend, char *host, int port, +int verify_ssh_host_key(Frontend *frontend, char *host, int port, const char *keytype, char *keystr, char *fingerprint, void (*callback)(void *ctx, int result), void *ctx) { @@ -223,7 +223,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port, * Ask whether the selected algorithm is acceptable (since it was * below the configured 'warn' threshold). */ -int askalg(void *frontend, const char *algtype, const char *algname, +int askalg(Frontend *frontend, const char *algtype, const char *algname, void (*callback)(void *ctx, int result), void *ctx) { static const char msg[] = @@ -270,7 +270,7 @@ int askalg(void *frontend, const char *algtype, const char *algname, } } -int askhk(void *frontend, const char *algname, const char *betteralgs, +int askhk(Frontend *frontend, const char *algname, const char *betteralgs, void (*callback)(void *ctx, int result), void *ctx) { static const char msg[] = @@ -327,7 +327,7 @@ int askhk(void *frontend, const char *algname, const char *betteralgs, * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -int askappend(void *frontend, Filename *filename, +int askappend(Frontend *frontend, Filename *filename, void (*callback)(void *ctx, int result), void *ctx) { static const char msgtemplate[] = @@ -410,7 +410,7 @@ void console_provide_logctx(LogContext *logctx) console_logctx = logctx; } -void logevent(void *frontend, const char *string) +void logevent(Frontend *frontend, const char *string) { struct termios cf; if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE)) @@ -546,7 +546,7 @@ int console_get_userpass_input(prompts_t *p) return 1; /* success */ } -void frontend_keypress(void *handle) +void frontend_keypress(Frontend *frontend) { /* * This is nothing but a stub, in console code. diff --git a/unix/uxpgnt.c b/unix/uxpgnt.c index 07248d39..6445fd57 100644 --- a/unix/uxpgnt.c +++ b/unix/uxpgnt.c @@ -42,7 +42,7 @@ void nonfatal(const char *p, ...) va_end(ap); fputc('\n', stderr); } -void connection_fatal(void *frontend, const char *p, ...) +void connection_fatal(Frontend *frontend, const char *p, ...) { va_list ap; fprintf(stderr, "FATAL ERROR: "); @@ -93,7 +93,7 @@ FontSpec *platform_default_fontspec(const char *name) { return fontspec_new(""); Filename *platform_default_filename(const char *name) { return filename_from_str(""); } char *x_get_default(const char *key) { return NULL; } void log_eventlog(LogContext *logctx, const char *event) {} -int from_backend(void *frontend, int is_stderr, const void *data, int datalen) +int from_backend(Frontend *fe, int is_stderr, const void *data, int datalen) { assert(!"only here to satisfy notional call from backend_socket_log"); } /* diff --git a/unix/uxplink.c b/unix/uxplink.c index 7bcac362..56bdf533 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -58,7 +58,7 @@ void nonfatal(const char *p, ...) fputc('\n', stderr); postmsg(&cf); } -void connection_fatal(void *frontend, const char *p, ...) +void connection_fatal(Frontend *frontend, const char *p, ...) { struct termios cf; va_list ap; @@ -132,7 +132,7 @@ int term_ldisc(Terminal *term, int mode) { return FALSE; } -void frontend_echoedit_update(void *frontend, int echo, int edit) +void frontend_echoedit_update(Frontend *frontend, int echo, int edit) { /* Update stdin read mode to reflect changes in line discipline. */ struct termios mode; @@ -190,7 +190,7 @@ static char *get_ttychar(struct termios *t, int index) return dupprintf("^<%d>", c); } -char *get_ttymode(void *frontend, const char *mode) +char *get_ttymode(Frontend *frontend, const char *mode) { /* * Propagate appropriate terminal modes from the local terminal, @@ -400,7 +400,7 @@ int try_output(int is_stderr) return bufchain_size(&stdout_data) + bufchain_size(&stderr_data); } -int from_backend(void *frontend_handle, int is_stderr, +int from_backend(Frontend *frontend, int is_stderr, const void *data, int len) { if (is_stderr) { @@ -413,7 +413,7 @@ int from_backend(void *frontend_handle, int is_stderr, } } -int from_backend_untrusted(void *frontend_handle, const void *data, int len) +int from_backend_untrusted(Frontend *frontend, const void *data, int len) { /* * No "untrusted" output should get here (the way the code is @@ -423,7 +423,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len) return 0; /* not reached */ } -int from_backend_eof(void *frontend_handle) +int from_backend_eof(Frontend *frontend) { assert(outgoingeof == EOF_NO); outgoingeof = EOF_PENDING; diff --git a/unix/uxpty.c b/unix/uxpty.c index 870e5156..a5c770d4 100644 --- a/unix/uxpty.c +++ b/unix/uxpty.c @@ -71,7 +71,7 @@ static int pty_signal_pipe[2] = { -1, -1 }; /* obviously bogus initial val */ struct pty_tag { Conf *conf; int master_fd, slave_fd; - void *frontend; + Frontend *frontend; char name[FILENAME_MAX]; pid_t child_pid; int term_width, term_height; @@ -729,7 +729,7 @@ static void pty_uxsel_setup(Pty pty) * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ -static const char *pty_init(void *frontend, Backend **backend_handle, +static const char *pty_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) { diff --git a/unix/uxser.c b/unix/uxser.c index e352f049..b02eb320 100644 --- a/unix/uxser.c +++ b/unix/uxser.c @@ -18,7 +18,7 @@ #define SERIAL_MAX_BACKLOG 4096 typedef struct serial_backend_data { - void *frontend; + Frontend *frontend; int fd; int finished; int inbufsize; @@ -288,7 +288,7 @@ static const char *serial_configure(Serial serial, Conf *conf) * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ -static const char *serial_init(void *frontend_handle, Backend **backend_handle, +static const char *serial_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) @@ -301,7 +301,7 @@ static const char *serial_init(void *frontend_handle, Backend **backend_handle, serial->backend.vt = &serial_backend; *backend_handle = &serial->backend; - serial->frontend = frontend_handle; + serial->frontend = frontend; serial->finished = FALSE; serial->inbufsize = 0; bufchain_init(&serial->output_data); diff --git a/unix/uxsftp.c b/unix/uxsftp.c index eb1329cf..a0d5c71e 100644 --- a/unix/uxsftp.c +++ b/unix/uxsftp.c @@ -66,7 +66,7 @@ Filename *platform_default_filename(const char *name) return filename_from_str(""); } -char *get_ttymode(void *frontend, const char *mode) { return NULL; } +char *get_ttymode(Frontend *frontend, const char *mode) { return NULL; } int get_userpass_input(prompts_t *p, bufchain *input) { diff --git a/windows/wincons.c b/windows/wincons.c index a7cbeeac..10367be8 100644 --- a/windows/wincons.c +++ b/windows/wincons.c @@ -30,11 +30,11 @@ void cleanup_exit(int code) exit(code); } -void set_busy_status(void *frontend, int status) +void set_busy_status(Frontend *frontend, int status) { } -void notify_remote_exit(void *frontend) +void notify_remote_exit(Frontend *frontend) { } @@ -42,7 +42,7 @@ void timer_change_notify(unsigned long next) { } -int verify_ssh_host_key(void *frontend, char *host, int port, +int verify_ssh_host_key(Frontend *frontend, char *host, int port, const char *keytype, char *keystr, char *fingerprint, void (*callback)(void *ctx, int result), void *ctx) { @@ -147,7 +147,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port, } } -void update_specials_menu(void *frontend) +void update_specials_menu(Frontend *frontend) { } @@ -155,7 +155,7 @@ void update_specials_menu(void *frontend) * Ask whether the selected algorithm is acceptable (since it was * below the configured 'warn' threshold). */ -int askalg(void *frontend, const char *algtype, const char *algname, +int askalg(Frontend *frontend, const char *algtype, const char *algname, void (*callback)(void *ctx, int result), void *ctx) { HANDLE hin; @@ -196,7 +196,7 @@ int askalg(void *frontend, const char *algtype, const char *algname, } } -int askhk(void *frontend, const char *algname, const char *betteralgs, +int askhk(Frontend *frontend, const char *algname, const char *betteralgs, void (*callback)(void *ctx, int result), void *ctx) { HANDLE hin; @@ -247,7 +247,7 @@ int askhk(void *frontend, const char *algname, const char *betteralgs, * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -int askappend(void *frontend, Filename *filename, +int askappend(Frontend *frontend, Filename *filename, void (*callback)(void *ctx, int result), void *ctx) { HANDLE hin; @@ -340,7 +340,7 @@ void console_provide_logctx(LogContext *logctx) console_logctx = logctx; } -void logevent(void *frontend, const char *string) +void logevent(Frontend *frontend, const char *string) { log_eventlog(console_logctx, string); } @@ -467,7 +467,7 @@ int console_get_userpass_input(prompts_t *p) return 1; /* success */ } -void frontend_keypress(void *handle) +void frontend_keypress(Frontend *frontend) { /* * This is nothing but a stub, in console code. diff --git a/windows/windlg.c b/windows/windlg.c index 352ae1fc..05ddfdd2 100644 --- a/windows/windlg.c +++ b/windows/windlg.c @@ -761,7 +761,7 @@ int do_reconfig(HWND hwnd, int protcfginfo) return ret; } -void logevent(void *frontend, const char *string) +void logevent(Frontend *frontend, const char *string) { char timebuf[40]; char **location; @@ -813,7 +813,7 @@ void showabout(HWND hwnd) DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTBOX), hwnd, AboutProc); } -int verify_ssh_host_key(void *frontend, char *host, int port, +int verify_ssh_host_key(Frontend *frontend, char *host, int port, const char *keytype, char *keystr, char *fingerprint, void (*callback)(void *ctx, int result), void *ctx) { @@ -897,7 +897,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port, * Ask whether the selected algorithm is acceptable (since it was * below the configured 'warn' threshold). */ -int askalg(void *frontend, const char *algtype, const char *algname, +int askalg(Frontend *frontend, const char *algtype, const char *algname, void (*callback)(void *ctx, int result), void *ctx) { static const char mbtitle[] = "%s Security Alert"; @@ -922,7 +922,7 @@ int askalg(void *frontend, const char *algtype, const char *algname, return 0; } -int askhk(void *frontend, const char *algname, const char *betteralgs, +int askhk(Frontend *frontend, const char *algname, const char *betteralgs, void (*callback)(void *ctx, int result), void *ctx) { static const char mbtitle[] = "%s Security Alert"; @@ -953,7 +953,7 @@ int askhk(void *frontend, const char *algname, const char *betteralgs, * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -int askappend(void *frontend, Filename *filename, +int askappend(Frontend *frontend, Filename *filename, void (*callback)(void *ctx, int result), void *ctx) { static const char msgtemplate[] = diff --git a/windows/window.c b/windows/window.c index 0d29b136..eb0f5e01 100644 --- a/windows/window.c +++ b/windows/window.c @@ -231,16 +231,16 @@ const int share_can_be_downstream = TRUE; const int share_can_be_upstream = TRUE; /* Dummy routine, only required in plink. */ -void frontend_echoedit_update(void *frontend, int echo, int edit) +void frontend_echoedit_update(Frontend *frontend, int echo, int edit) { } -int frontend_is_utf8(void *frontend) +int frontend_is_utf8(Frontend *frontend) { return ucsdata.line_codepage == CP_UTF8; } -char *get_ttymode(void *frontend, const char *mode) +char *get_ttymode(Frontend *frontend, const char *mode) { return term_get_ttymode(term, mode); } @@ -946,7 +946,7 @@ static void update_savedsess_menu(void) /* * Update the Special Commands submenu. */ -void update_specials_menu(void *frontend) +void update_specials_menu(Frontend *frontend) { HMENU new_menu; int i, j; @@ -1052,7 +1052,7 @@ static void update_mouse_pointer(void) } } -void set_busy_status(void *frontend, int status) +void set_busy_status(Frontend *frontend, int status) { busy_status = status; update_mouse_pointer(); @@ -1061,7 +1061,7 @@ void set_busy_status(void *frontend, int status) /* * set or clear the "raw mouse message" mode */ -void set_raw_mouse_mode(void *frontend, int activate) +void set_raw_mouse_mode(Frontend *frontend, int activate) { activate = activate && !conf_get_int(conf, CONF_no_mouse_rep); send_raw_mouse = activate; @@ -1071,7 +1071,7 @@ void set_raw_mouse_mode(void *frontend, int activate) /* * Print a message box and close the connection. */ -void connection_fatal(void *frontend, const char *fmt, ...) +void connection_fatal(Frontend *frontend, const char *fmt, ...) { va_list ap; char *stuff, morestuff[100]; @@ -1622,7 +1622,7 @@ static void deinit_fonts(void) } } -void request_resize(void *frontend, int w, int h) +void request_resize(Frontend *frontend, int w, int h) { int width, height; @@ -1970,7 +1970,7 @@ static int is_alt_pressed(void) static int resizing; -void notify_remote_exit(void *fe) +void notify_remote_exit(Frontend *frontend) { int exitcode, close_on_exit; @@ -3277,7 +3277,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, * helper software tracks the system caret, so we should arrange to * have one.) */ -void sys_cursor(void *frontend, int x, int y) +void sys_cursor(Frontend *frontend, int x, int y) { int cx, cy; @@ -4813,7 +4813,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, return -1; } -void set_title(void *frontend, char *title) +void set_title(Frontend *frontend, char *title) { sfree(window_name); window_name = snewn(1 + strlen(title), char); @@ -4822,7 +4822,7 @@ void set_title(void *frontend, char *title) SetWindowText(hwnd, title); } -void set_icon(void *frontend, char *title) +void set_icon(Frontend *frontend, char *title) { sfree(icon_name); icon_name = snewn(1 + strlen(title), char); @@ -4831,7 +4831,7 @@ void set_icon(void *frontend, char *title) SetWindowText(hwnd, title); } -void set_sbar(void *frontend, int total, int start, int page) +void set_sbar(Frontend *frontend, int total, int start, int page) { SCROLLINFO si; @@ -4849,7 +4849,7 @@ void set_sbar(void *frontend, int total, int start, int page) SetScrollInfo(hwnd, SB_VERT, &si, TRUE); } -Context get_ctx(void *frontend) +Context get_ctx(Frontend *frontend) { HDC hdc; if (hwnd) { @@ -4879,7 +4879,7 @@ static void real_palette_set(int n, int r, int g, int b) } } -int palette_get(void *frontend, int n, int *r, int *g, int *b) +int palette_get(Frontend *frontend, int n, int *r, int *g, int *b) { if (n < 0 || n >= NALLCOLOURS) return FALSE; @@ -4889,7 +4889,7 @@ int palette_get(void *frontend, int n, int *r, int *g, int *b) return TRUE; } -void palette_set(void *frontend, int n, int r, int g, int b) +void palette_set(Frontend *frontend, int n, int r, int g, int b) { if (n >= 16) n += 256 - 16; @@ -4910,7 +4910,7 @@ void palette_set(void *frontend, int n, int r, int g, int b) } } -void palette_reset(void *frontend) +void palette_reset(Frontend *frontend) { int i; @@ -4939,7 +4939,7 @@ void palette_reset(void *frontend) } } -void write_aclip(void *frontend, int clipboard, +void write_aclip(Frontend *frontend, int clipboard, char *data, int len, int must_deselect) { HGLOBAL clipdata; @@ -4987,7 +4987,7 @@ int cmpCOLORREF(void *va, void *vb) /* * Note: unlike write_aclip() this will not append a nul. */ -void write_clip(void *frontend, int clipboard, +void write_clip(Frontend *frontend, int clipboard, wchar_t *data, int *attr, truecolour *truecolour, int len, int must_deselect) { @@ -5458,7 +5458,7 @@ static void process_clipdata(HGLOBAL clipdata, int unicode) sfree(clipboard_contents); } -void frontend_request_paste(void *frontend, int clipboard) +void frontend_request_paste(Frontend *frontend, int clipboard) { assert(clipboard == CLIP_SYSTEM); @@ -5488,7 +5488,7 @@ void frontend_request_paste(void *frontend, int clipboard) * Move `lines' lines from position `from' to position `to' in the * window. */ -void optimised_move(void *frontend, int to, int from, int lines) +void optimised_move(Frontend *frontend, int to, int from, int lines) { RECT r; int min, max; @@ -5618,7 +5618,7 @@ static void flash_window(int mode) /* * Beep. */ -void do_beep(void *frontend, int mode) +void do_beep(Frontend *frontend, int mode) { if (mode == BELL_DEFAULT) { /* @@ -5680,7 +5680,7 @@ void do_beep(void *frontend, int mode) * Minimise or restore the window in response to a server-side * request. */ -void set_iconic(void *frontend, int iconic) +void set_iconic(Frontend *frontend, int iconic) { if (IsIconic(hwnd)) { if (!iconic) @@ -5694,7 +5694,7 @@ void set_iconic(void *frontend, int iconic) /* * Move the window in response to a server-side request. */ -void move_window(void *frontend, int x, int y) +void move_window(Frontend *frontend, int x, int y) { int resize_action = conf_get_int(conf, CONF_resize_action); if (resize_action == RESIZE_DISABLED || @@ -5709,7 +5709,7 @@ void move_window(void *frontend, int x, int y) * Move the window to the top or bottom of the z-order in response * to a server-side request. */ -void set_zorder(void *frontend, int top) +void set_zorder(Frontend *frontend, int top) { if (conf_get_int(conf, CONF_alwaysontop)) return; /* ignore */ @@ -5720,7 +5720,7 @@ void set_zorder(void *frontend, int top) /* * Refresh the window in response to a server-side request. */ -void refresh_window(void *frontend) +void refresh_window(Frontend *frontend) { InvalidateRect(hwnd, NULL, TRUE); } @@ -5729,7 +5729,7 @@ void refresh_window(void *frontend) * Maximise or restore the window in response to a server-side * request. */ -void set_zoomed(void *frontend, int zoomed) +void set_zoomed(Frontend *frontend, int zoomed) { if (IsZoomed(hwnd)) { if (!zoomed) @@ -5743,7 +5743,7 @@ void set_zoomed(void *frontend, int zoomed) /* * Report whether the window is iconic, for terminal reports. */ -int is_iconic(void *frontend) +int is_iconic(Frontend *frontend) { return IsIconic(hwnd); } @@ -5751,7 +5751,7 @@ int is_iconic(void *frontend) /* * Report the window's position, for terminal reports. */ -void get_window_pos(void *frontend, int *x, int *y) +void get_window_pos(Frontend *frontend, int *x, int *y) { RECT r; GetWindowRect(hwnd, &r); @@ -5762,7 +5762,7 @@ void get_window_pos(void *frontend, int *x, int *y) /* * Report the window's pixel size, for terminal reports. */ -void get_window_pixels(void *frontend, int *x, int *y) +void get_window_pixels(Frontend *frontend, int *x, int *y) { RECT r; GetWindowRect(hwnd, &r); @@ -5773,7 +5773,7 @@ void get_window_pixels(void *frontend, int *x, int *y) /* * Return the window or icon title. */ -char *get_window_title(void *frontend, int icon) +char *get_window_title(Frontend *frontend, int icon) { return icon ? icon_name : window_name; } @@ -5906,7 +5906,7 @@ static void flip_full_screen() } } -void frontend_keypress(void *handle) +void frontend_keypress(Frontend *frontend) { /* * Keypress termination in non-Close-On-Exit mode is not @@ -5917,17 +5917,17 @@ void frontend_keypress(void *handle) return; } -int from_backend(void *frontend, int is_stderr, const void *data, int len) +int from_backend(Frontend *frontend, int is_stderr, const void *data, int len) { return term_data(term, is_stderr, data, len); } -int from_backend_untrusted(void *frontend, const void *data, int len) +int from_backend_untrusted(Frontend *frontend, const void *data, int len) { return term_data_untrusted(term, data, len); } -int from_backend_eof(void *frontend) +int from_backend_eof(Frontend *frontend) { return TRUE; /* do respond to incoming EOF with outgoing */ } diff --git a/windows/winplink.c b/windows/winplink.c index 455b18a7..c156d740 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -45,7 +45,7 @@ void nonfatal(const char *p, ...) va_end(ap); fputc('\n', stderr); } -void connection_fatal(void *frontend, const char *p, ...) +void connection_fatal(Frontend *frontend, const char *p, ...) { va_list ap; fprintf(stderr, "FATAL ERROR: "); @@ -83,7 +83,7 @@ int term_ldisc(Terminal *term, int mode) { return FALSE; } -void frontend_echoedit_update(void *frontend, int echo, int edit) +void frontend_echoedit_update(Frontend *frontend, int echo, int edit) { /* Update stdin read mode to reflect changes in line discipline. */ DWORD mode; @@ -100,9 +100,9 @@ void frontend_echoedit_update(void *frontend, int echo, int edit) SetConsoleMode(inhandle, mode); } -char *get_ttymode(void *frontend, const char *mode) { return NULL; } +char *get_ttymode(Frontend *frontend, const char *mode) { return NULL; } -int from_backend(void *frontend_handle, int is_stderr, +int from_backend(Frontend *frontend, int is_stderr, const void *data, int len) { if (is_stderr) { @@ -114,7 +114,7 @@ int from_backend(void *frontend_handle, int is_stderr, return handle_backlog(stdout_handle) + handle_backlog(stderr_handle); } -int from_backend_untrusted(void *frontend_handle, const void *data, int len) +int from_backend_untrusted(Frontend *frontend, const void *data, int len) { /* * No "untrusted" output should get here (the way the code is @@ -124,7 +124,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len) return 0; /* not reached */ } -int from_backend_eof(void *frontend_handle) +int from_backend_eof(Frontend *frontend) { handle_write_eof(stdout_handle); return FALSE; /* do not respond to incoming EOF with outgoing */ diff --git a/windows/winser.c b/windows/winser.c index 1efac931..2a42ce21 100644 --- a/windows/winser.c +++ b/windows/winser.c @@ -13,7 +13,7 @@ typedef struct serial_backend_data { HANDLE port; struct handle *out, *in; - void *frontend; + Frontend *frontend; int bufsize; long clearbreak_time; int break_in_progress; @@ -199,7 +199,7 @@ static const char *serial_configure(Serial serial, HANDLE serport, Conf *conf) * Also places the canonical host name into `realhost'. It must be * freed by the caller. */ -static const char *serial_init(void *frontend_handle, Backend **backend_handle, +static const char *serial_init(Frontend *frontend, Backend **backend_handle, Conf *conf, const char *host, int port, char **realhost, int nodelay, int keepalive) { @@ -216,7 +216,7 @@ static const char *serial_init(void *frontend_handle, Backend **backend_handle, serial->backend.vt = &serial_backend; *backend_handle = &serial->backend; - serial->frontend = frontend_handle; + serial->frontend = frontend; serline = conf_get_str(conf, CONF_serline); { diff --git a/windows/winsftp.c b/windows/winsftp.c index e9d5d4cb..580e8d95 100644 --- a/windows/winsftp.c +++ b/windows/winsftp.c @@ -13,7 +13,7 @@ #include "int64.h" #include "winsecur.h" -char *get_ttymode(void *frontend, const char *mode) { return NULL; } +char *get_ttymode(Frontend *frontend, const char *mode) { return NULL; } int get_userpass_input(prompts_t *p, bufchain *input) { diff --git a/windows/winstuff.h b/windows/winstuff.h index 87dc48b6..1ecec333 100644 --- a/windows/winstuff.h +++ b/windows/winstuff.h @@ -247,7 +247,7 @@ GLOBAL LogContext *logctx; * which takes the data string in the system code page instead of * Unicode. */ -void write_aclip(void *frontend, int clipboard, char *, int, int); +void write_aclip(Frontend *frontend, int clipboard, char *, int, int); #define WM_NETEVENT (WM_APP + 5)