5 # include "uxconfig.h" /* Space to hide it from mkfiles.pl */
8 #include <stdio.h> /* for FILENAME_MAX */
9 #include <stdint.h> /* C99 int types */
11 #include <dlfcn.h> /* Dynamic library loading */
14 #include <sys/types.h> /* for mode_t */
18 * Assorted tweaks to various parts of the GTK front end which all
19 * need to be enabled when compiling on OS X. Because I might need the
20 * same tweaks on other systems in future, I don't want to
21 * conditionalise all of them on OSX_GTK directly, so instead, each
22 * one has its own name and we enable them all centrally here if
23 * OSX_GTK is defined at configure time.
25 #define NOT_X_WINDOWS /* of course, all the X11 stuff should be disabled */
26 #define NO_PTY_PRE_INIT /* OS X gets very huffy if we try to set[ug]id */
27 #define SET_NONBLOCK_VIA_OPENPT /* work around missing fcntl functionality */
28 #define OSX_META_KEY_CONFIG /* two possible Meta keys to choose from */
29 /* this potential one of the Meta keys needs manual handling */
30 #define META_MANUAL_MASK (GDK_MOD1_MASK)
31 #define JUST_USE_GTK_CLIPBOARD_UTF8 /* low-level gdk_selection_* fails */
32 #define DEFAULT_CLIPBOARD GDK_SELECTION_CLIPBOARD /* OS X has no PRIMARY */
38 FILE *f_open(const struct Filename *, char const *, int);
41 char *name; /* may be "" to indicate no selected font at all */
43 struct FontSpec *fontspec_new(const char *name);
45 typedef void *Context; /* FIXME: probably needs changing */
47 extern Backend pty_backend;
49 #define BROKEN_PIPE_ERROR_CODE EPIPE /* used in sshshare.c */
51 typedef uint32_t uint32; /* C99: uint32_t defined in stdint.h */
52 #define PUTTY_UINT32_DEFINED
55 * Under GTK, we send MA_CLICK _and_ MA_2CLK, or MA_CLICK _and_
56 * MA_3CLK, when a button is pressed for the second or third time.
58 #define MULTICLICK_ONLY_EVENT 0
61 * Under GTK, there is no context help available.
63 #define HELPCTX(x) P(NULL)
64 #define FILTER_KEY_FILES NULL /* FIXME */
65 #define FILTER_DYNLIB_FILES NULL /* FIXME */
68 * Under X, selection data must not be NUL-terminated.
70 #define SELECTION_NUL_TERMINATED 0
73 * Under X, copying to the clipboard terminates lines with just LF.
77 /* Simple wraparound timer function */
78 unsigned long getticks(void);
79 #define GETTICKCOUNT getticks
80 #define TICKSPERSEC 1000 /* we choose to use milliseconds */
81 #define CURSORBLINK 450 /* no standard way to set this */
84 #define BYTE unsigned char
87 * Unix-specific global flag
89 * FLAG_STDERR_TTY indicates that standard error might be a terminal and
90 * might get its configuration munged, so anything trying to output plain
91 * text (i.e. with newlines in it) will need to put it back into cooked
92 * mode first. Applications setting this flag should also call
93 * stderr_tty_init() before messing with any terminal modes, and can call
94 * premsg() before outputting text to stderr and postmsg() afterwards.
96 #define FLAG_STDERR_TTY 0x1000
98 /* The per-session frontend structure managed by gtkwin.c */
100 struct gui_data *new_session_window(Conf *conf, const char *geometry_string);
102 /* Defined in gtkmain.c */
103 void launch_duplicate_session(Conf *conf);
104 void launch_new_session(void);
105 void launch_saved_session(const char *str);
106 #ifdef MAY_REFER_TO_GTK_IN_HEADERS
107 GtkWidget *make_gtk_toplevel_window(void *frontend);
110 /* Defined in gtkcomm.c */
111 void gtkcomm_setup(void);
113 /* Things pty.c needs from pterm.c */
114 const char *get_x_display(void *frontend);
115 int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
116 long get_windowid(void *frontend);
117 int frontend_is_utf8(void *frontend);
119 /* Things gtkdlg.c needs from pterm.c */
120 void *get_window(void *frontend); /* void * to avoid depending on gtk.h */
121 void post_main(void); /* called after any subsidiary gtk_main() */
123 /* Things pterm.c needs from gtkdlg.c */
124 int do_config_box(const char *title, Conf *conf,
125 int midsession, int protcfginfo);
126 void fatal_message_box(void *window, const char *msg);
127 void nonfatal_message_box(void *window, const char *msg);
128 void about_box(void *window);
129 void *eventlogstuff_new(void);
130 void showeventlog(void *estuff, void *parentwin);
131 void logevent_dlg(void *estuff, const char *string);
132 int reallyclose(void *frontend);
133 #ifdef MAY_REFER_TO_GTK_IN_HEADERS
134 int messagebox(GtkWidget *parentwin, const char *title,
135 const char *msg, int minwid, int selectable, ...);
138 /* Things pterm.c needs from {ptermm,uxputty}.c */
139 char *make_default_wintitle(char *hostname);
140 int process_nonoption_arg(const char *arg, Conf *conf, int *allow_launch);
142 /* pterm.c needs this special function in xkeysym.c */
143 int keysym_to_unicode(int keysym);
145 /* Things uxstore.c needs from pterm.c */
146 char *x_get_default(const char *key);
148 /* Things uxstore.c provides to pterm.c */
149 void provide_xrm_string(char *string);
151 /* Things provided by uxcons.c */
153 void stderr_tty_init(void);
154 void premsg(struct termios *);
155 void postmsg(struct termios *);
157 /* The interface used by uxsel.c */
158 typedef struct uxsel_id uxsel_id;
159 void uxsel_init(void);
160 typedef int (*uxsel_callback_fn)(int fd, int event);
161 void uxsel_set(int fd, int rwx, uxsel_callback_fn callback);
162 void uxsel_del(int fd);
163 int select_result(int fd, int event);
164 int first_fd(int *state, int *rwx);
165 int next_fd(int *state, int *rwx);
166 /* The following are expected to be provided _to_ uxsel.c by the frontend */
167 uxsel_id *uxsel_input_add(int fd, int rwx); /* returns an id */
168 void uxsel_input_remove(uxsel_id *id);
172 void unix_setup_config_box(struct controlbox *b, int midsession, int protocol);
175 void gtk_setup_config_box(struct controlbox *b, int midsession, void *window);
178 * In the Unix Unicode layer, DEFAULT_CODEPAGE is a special value
179 * which causes mb_to_wc and wc_to_mb to call _libc_ rather than
180 * libcharset. That way, we can interface the various charsets
181 * supported by libcharset with the one supported by mbstowcs and
182 * wcstombs (which will be the character set in which stuff read
183 * from the command line or config files is assumed to be encoded).
185 #define DEFAULT_CODEPAGE 0xFFFF
186 #define CP_UTF8 CS_UTF8 /* from libcharset */
188 #define strnicmp strncasecmp
189 #define stricmp strcasecmp
191 /* BSD-semantics version of signal(), and another helpful function */
192 void (*putty_signal(int sig, void (*func)(int)))(int);
193 void block_signal(int sig, int block_it);
197 void noncloexec(int);
199 int no_nonblock(int);
200 char *make_dir_and_check_ours(const char *dirname);
201 char *make_dir_path(const char *path, mode_t mode);
204 * Exports from unicode.c.
207 int init_ucs(struct unicode_data *ucsdata, char *line_codepage,
208 int utf8_override, int font_charset, int vtmode);
211 * Spare function exported directly from uxnet.c.
213 void *sk_getxdmdata(void *sock, int *lenp);
216 * General helpful Unix stuff: more helpful version of the FD_SET
217 * macro, which also handles maxfd.
219 #define FD_SET_MAX(fd, max, set) do { \
221 if (max < fd + 1) max = fd + 1; \
225 * Exports from winser.c.
227 extern Backend serial_backend;
230 * uxpeer.c, wrapping getsockopt(SO_PEERCRED).
232 int so_peercred(int fd, int *pid, int *uid, int *gid);
235 * Default font setting, which can vary depending on NOT_X_WINDOWS.
238 #define DEFAULT_GTK_FONT "client:Monospace 12"
240 #define DEFAULT_GTK_FONT "server:fixed"