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 */
17 * Assorted tweaks to various parts of the GTK front end which all
18 * need to be enabled when compiling on OS X. Because I might need the
19 * same tweaks on other systems in future, I don't want to
20 * conditionalise all of them on OSX_GTK directly, so instead, each
21 * one has its own name and we enable them all centrally here if
22 * OSX_GTK is defined at configure time.
24 #define NOT_X_WINDOWS /* of course, all the X11 stuff should be disabled */
25 #define NO_PTY_PRE_INIT /* OS X gets very huffy if we try to set[ug]id */
26 #define SET_NONBLOCK_VIA_OPENPT /* work around missing fcntl functionality */
32 FILE *f_open(const struct Filename *, char const *, int);
35 char *name; /* may be "" to indicate no selected font at all */
37 struct FontSpec *fontspec_new(const char *name);
39 typedef void *Context; /* FIXME: probably needs changing */
41 extern Backend pty_backend;
43 typedef uint32_t uint32; /* C99: uint32_t defined in stdint.h */
44 #define PUTTY_UINT32_DEFINED
47 * Under GTK, we send MA_CLICK _and_ MA_2CLK, or MA_CLICK _and_
48 * MA_3CLK, when a button is pressed for the second or third time.
50 #define MULTICLICK_ONLY_EVENT 0
53 * Under GTK, there is no context help available.
55 #define HELPCTX(x) P(NULL)
56 #define FILTER_KEY_FILES NULL /* FIXME */
57 #define FILTER_DYNLIB_FILES NULL /* FIXME */
60 * Under X, selection data must not be NUL-terminated.
62 #define SELECTION_NUL_TERMINATED 0
65 * Under X, copying to the clipboard terminates lines with just LF.
69 /* Simple wraparound timer function */
70 unsigned long getticks(void); /* based on gettimeofday(2) */
71 #define GETTICKCOUNT getticks
72 #define TICKSPERSEC 1000 /* we choose to use milliseconds */
73 #define CURSORBLINK 450 /* no standard way to set this */
76 #define BYTE unsigned char
79 * Unix-specific global flag
81 * FLAG_STDERR_TTY indicates that standard error might be a terminal and
82 * might get its configuration munged, so anything trying to output plain
83 * text (i.e. with newlines in it) will need to put it back into cooked
84 * mode first. Applications setting this flag should also call
85 * stderr_tty_init() before messing with any terminal modes, and can call
86 * premsg() before outputting text to stderr and postmsg() afterwards.
88 #define FLAG_STDERR_TTY 0x1000
90 /* Things pty.c needs from pterm.c */
91 const char *get_x_display(void *frontend);
92 int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
93 long get_windowid(void *frontend);
95 /* Things gtkdlg.c needs from pterm.c */
96 void *get_window(void *frontend); /* void * to avoid depending on gtk.h */
97 void post_main(void); /* called after any subsidiary gtk_main() */
99 /* Things pterm.c needs from gtkdlg.c */
100 int do_config_box(const char *title, Conf *conf,
101 int midsession, int protcfginfo);
102 void fatal_message_box(void *window, const char *msg);
103 void nonfatal_message_box(void *window, const char *msg);
104 void about_box(void *window);
105 void *eventlogstuff_new(void);
106 void showeventlog(void *estuff, void *parentwin);
107 void logevent_dlg(void *estuff, const char *string);
108 int reallyclose(void *frontend);
109 #ifdef MAY_REFER_TO_GTK_IN_HEADERS
110 int messagebox(GtkWidget *parentwin, const char *title,
111 const char *msg, int minwid, ...);
114 /* Things pterm.c needs from {ptermm,uxputty}.c */
115 char *make_default_wintitle(char *hostname);
116 int process_nonoption_arg(const char *arg, Conf *conf, int *allow_launch);
118 /* pterm.c needs this special function in xkeysym.c */
119 int keysym_to_unicode(int keysym);
121 /* Things uxstore.c needs from pterm.c */
122 char *x_get_default(const char *key);
124 /* Things uxstore.c provides to pterm.c */
125 void provide_xrm_string(char *string);
127 /* Things provided by uxcons.c */
129 void stderr_tty_init(void);
130 void premsg(struct termios *);
131 void postmsg(struct termios *);
133 /* The interface used by uxsel.c */
134 typedef struct uxsel_id uxsel_id;
135 void uxsel_init(void);
136 typedef int (*uxsel_callback_fn)(int fd, int event);
137 void uxsel_set(int fd, int rwx, uxsel_callback_fn callback);
138 void uxsel_del(int fd);
139 int select_result(int fd, int event);
140 int first_fd(int *state, int *rwx);
141 int next_fd(int *state, int *rwx);
142 /* The following are expected to be provided _to_ uxsel.c by the frontend */
143 uxsel_id *uxsel_input_add(int fd, int rwx); /* returns an id */
144 void uxsel_input_remove(uxsel_id *id);
148 void unix_setup_config_box(struct controlbox *b, int midsession, int protocol);
151 void gtk_setup_config_box(struct controlbox *b, int midsession, void *window);
154 * In the Unix Unicode layer, DEFAULT_CODEPAGE is a special value
155 * which causes mb_to_wc and wc_to_mb to call _libc_ rather than
156 * libcharset. That way, we can interface the various charsets
157 * supported by libcharset with the one supported by mbstowcs and
158 * wcstombs (which will be the character set in which stuff read
159 * from the command line or config files is assumed to be encoded).
161 #define DEFAULT_CODEPAGE 0xFFFF
162 #define CP_UTF8 CS_UTF8 /* from libcharset */
164 #define strnicmp strncasecmp
165 #define stricmp strcasecmp
167 /* BSD-semantics version of signal(), and another helpful function */
168 void (*putty_signal(int sig, void (*func)(int)))(int);
169 void block_signal(int sig, int block_it);
173 void noncloexec(int);
175 int no_nonblock(int);
176 char *make_dir_and_check_ours(const char *dirname);
179 * Exports from unicode.c.
182 int init_ucs(struct unicode_data *ucsdata, char *line_codepage,
183 int utf8_override, int font_charset, int vtmode);
186 * Spare function exported directly from uxnet.c.
188 void *sk_getxdmdata(void *sock, int *lenp);
191 * General helpful Unix stuff: more helpful version of the FD_SET
192 * macro, which also handles maxfd.
194 #define FD_SET_MAX(fd, max, set) do { \
196 if (max < fd + 1) max = fd + 1; \
200 * Exports from winser.c.
202 extern Backend serial_backend;
205 * uxpeer.c, wrapping getsockopt(SO_PEERCRED).
207 int so_peercred(int fd, int *pid, int *uid, int *gid);
210 * Default font setting, which can vary depending on NOT_X_WINDOWS.
213 #define DEFAULT_GTK_FONT "client:Monospace 12"
215 #define DEFAULT_GTK_FONT "server:fixed"