8c3cd914 |
1 | /* |
2 | * winstuff.h: Windows-specific inter-module stuff. |
3 | */ |
4 | |
f7f27309 |
5 | #ifndef PUTTY_WINSTUFF_H |
6 | #define PUTTY_WINSTUFF_H |
7 | |
9a30e26b |
8 | #include <stdio.h> /* for FILENAME_MAX */ |
9 | |
10 | struct Filename { |
11 | char path[FILENAME_MAX]; |
12 | }; |
13 | #define f_open(filename, mode) ( fopen((filename).path, (mode)) ) |
14 | |
15 | struct FontSpec { |
16 | char name[64]; |
17 | int isbold; |
18 | int height; |
19 | int charset; |
20 | }; |
21 | |
8c3cd914 |
22 | /* |
23 | * Global variables. Most modules declare these `extern', but |
24 | * window.c will do `#define PUTTY_DO_GLOBALS' before including this |
25 | * module, and so will get them properly defined. |
26 | */ |
f7f27309 |
27 | #ifndef GLOBAL |
8c3cd914 |
28 | #ifdef PUTTY_DO_GLOBALS |
29 | #define GLOBAL |
30 | #else |
31 | #define GLOBAL extern |
32 | #endif |
f7f27309 |
33 | #endif |
34 | |
a8327734 |
35 | #ifndef DONE_TYPEDEFS |
36 | #define DONE_TYPEDEFS |
37 | typedef struct config_tag Config; |
38 | typedef struct backend_tag Backend; |
39 | typedef struct terminal_tag Terminal; |
40 | #endif |
41 | |
f7f27309 |
42 | #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY" |
43 | #define PUTTY_REG_PARENT "Software\\SimonTatham" |
44 | #define PUTTY_REG_PARENT_CHILD "PuTTY" |
45 | #define PUTTY_REG_GPARENT "Software" |
46 | #define PUTTY_REG_GPARENT_CHILD "SimonTatham" |
47 | |
48 | #define GETTICKCOUNT GetTickCount |
49 | #define CURSORBLINK GetCaretBlinkTime() |
50 | #define TICKSPERSEC 1000 /* GetTickCount returns milliseconds */ |
51 | |
52 | #define DEFAULT_CODEPAGE CP_ACP |
53 | |
54 | typedef HDC Context; |
8c3cd914 |
55 | |
f7f27309 |
56 | /* |
57 | * Window handles for the dialog boxes that can be running during a |
58 | * PuTTY session. |
59 | */ |
60 | GLOBAL HWND logbox; |
61 | |
62 | /* |
63 | * The all-important instance handle. |
64 | */ |
8c3cd914 |
65 | GLOBAL HINSTANCE hinst; |
66 | |
67 | /* |
6b78788a |
68 | * Details of the help file. |
69 | */ |
70 | GLOBAL char *help_path; |
71 | GLOBAL int help_has_contents; |
72 | |
73 | /* |
a8327734 |
74 | * The terminal and logging context are notionally local to the |
75 | * Windows front end, but they must be shared between window.c and |
0b4f0bc0 |
76 | * windlg.c. Likewise the saved-sessions list. |
a8327734 |
77 | */ |
78 | GLOBAL Terminal *term; |
79 | GLOBAL void *logctx; |
80 | |
81 | /* |
f7f27309 |
82 | * I've just looked in the windows standard headr files for WM_USER, there |
83 | * are hundreds of flags defined using the form WM_USER+123 so I've |
84 | * renumbered this NETEVENT value and the two in window.c |
85 | */ |
86 | #define WM_XUSER (WM_USER + 0x2000) |
87 | #define WM_NETEVENT (WM_XUSER + 5) |
88 | |
89 | /* |
e6346999 |
90 | * On Windows, we send MA_2CLK as the only event marking the second |
91 | * press of a mouse button. Compare unix.h. |
92 | */ |
93 | #define MULTICLICK_ONLY_EVENT 1 |
94 | |
95 | /* |
96 | * On Windows, data written to the clipboard must be NUL-terminated. |
97 | */ |
98 | #define SELECTION_NUL_TERMINATED 1 |
99 | |
100 | /* |
0f351587 |
101 | * On Windows, copying to the clipboard terminates lines with CRLF. |
102 | */ |
103 | #define SEL_NL { 13, 10 } |
104 | |
105 | /* |
2f92b717 |
106 | * sk_getxdmdata() does not exist under Windows (not that I |
107 | * couldn't write it if I wanted to, but I haven't bothered), so |
108 | * it's a macro which always returns FALSE. With any luck this will |
109 | * cause the compiler to notice it can optimise away the |
110 | * implementation of XDM-AUTHORIZATION-1 in x11fwd.c :-) |
111 | */ |
112 | #define sk_getxdmdata(socket, ip, port) (0) |
113 | |
114 | /* |
8c3cd914 |
115 | * Exports from winctrls.c. |
116 | */ |
117 | |
118 | struct ctlpos { |
119 | HWND hwnd; |
120 | WPARAM font; |
121 | int dlu4inpix; |
122 | int ypos, width; |
123 | int xoff; |
3ac9cd9f |
124 | int boxystart, boxid; |
8c3cd914 |
125 | char *boxtext; |
126 | }; |
127 | |
ca20bfcf |
128 | /* |
c0a81592 |
129 | * Exports from winutils.c. |
130 | */ |
d3a1a808 |
131 | void split_into_argv(char *, int *, char ***, char ***); |
c0a81592 |
132 | |
133 | /* |
ca20bfcf |
134 | * Private structure for prefslist state. Only in the header file |
135 | * so that we can delegate allocation to callers. |
136 | */ |
137 | struct prefslist { |
138 | int listid, upbid, dnbid; |
139 | int srcitem; |
140 | int dummyitem; |
141 | int dragging; |
142 | }; |
143 | |
f7f27309 |
144 | /* |
145 | * Exports from winctrls.c. |
146 | */ |
8c3cd914 |
147 | void ctlposinit(struct ctlpos *cp, HWND hwnd, |
32874aea |
148 | int leftborder, int rightborder, int topborder); |
ca20bfcf |
149 | HWND doctl(struct ctlpos *cp, RECT r, |
32874aea |
150 | char *wclass, int wstyle, int exstyle, char *wtext, int wid); |
8c3cd914 |
151 | void bartitle(struct ctlpos *cp, char *name, int id); |
3ac9cd9f |
152 | void beginbox(struct ctlpos *cp, char *name, int idbox); |
8c3cd914 |
153 | void endbox(struct ctlpos *cp); |
154 | void multiedit(struct ctlpos *cp, ...); |
32874aea |
155 | void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...); |
d74d141c |
156 | void bareradioline(struct ctlpos *cp, int nacross, ...); |
8c3cd914 |
157 | void radiobig(struct ctlpos *cp, char *text, int id, ...); |
158 | void checkbox(struct ctlpos *cp, char *text, int id); |
66ee282a |
159 | void statictext(struct ctlpos *cp, char *text, int lines, int id); |
8c3cd914 |
160 | void staticbtn(struct ctlpos *cp, char *stext, int sid, |
32874aea |
161 | char *btext, int bid); |
af282e3b |
162 | void static2btn(struct ctlpos *cp, char *stext, int sid, |
163 | char *btext1, int bid1, char *btext2, int bid2); |
8c3cd914 |
164 | void staticedit(struct ctlpos *cp, char *stext, |
32874aea |
165 | int sid, int eid, int percentedit); |
2c9c6388 |
166 | void staticddl(struct ctlpos *cp, char *stext, |
167 | int sid, int lid, int percentlist); |
b8ae1f0f |
168 | void combobox(struct ctlpos *cp, char *text, int staticid, int listid); |
6e522441 |
169 | void staticpassedit(struct ctlpos *cp, char *stext, |
32874aea |
170 | int sid, int eid, int percentedit); |
6e522441 |
171 | void bigeditctrl(struct ctlpos *cp, char *stext, |
32874aea |
172 | int sid, int eid, int lines); |
173 | void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id); |
8c3cd914 |
174 | void editbutton(struct ctlpos *cp, char *stext, int sid, |
32874aea |
175 | int eid, char *btext, int bid); |
8c3cd914 |
176 | void sesssaver(struct ctlpos *cp, char *text, |
32874aea |
177 | int staticid, int editid, int listid, ...); |
8c3cd914 |
178 | void envsetter(struct ctlpos *cp, char *stext, int sid, |
32874aea |
179 | char *e1stext, int e1sid, int e1id, |
180 | char *e2stext, int e2sid, int e2id, |
181 | int listid, char *b1text, int b1id, char *b2text, int b2id); |
8c3cd914 |
182 | void charclass(struct ctlpos *cp, char *stext, int sid, int listid, |
32874aea |
183 | char *btext, int bid, int eid, char *s2text, int s2id); |
8c3cd914 |
184 | void colouredit(struct ctlpos *cp, char *stext, int sid, int listid, |
32874aea |
185 | char *btext, int bid, ...); |
ca20bfcf |
186 | void prefslist(struct prefslist *hdl, struct ctlpos *cp, char *stext, |
187 | int sid, int listid, int upbid, int dnbid); |
188 | int handle_prefslist(struct prefslist *hdl, |
189 | int *array, int maxmemb, |
190 | int is_dlmsg, HWND hwnd, |
191 | WPARAM wParam, LPARAM lParam); |
6e522441 |
192 | void progressbar(struct ctlpos *cp, int id); |
d74d141c |
193 | void fwdsetter(struct ctlpos *cp, int listid, char *stext, int sid, |
194 | char *e1stext, int e1sid, int e1id, |
195 | char *e2stext, int e2sid, int e2id, |
a4b92c62 |
196 | char *btext, int bid, |
197 | char *r1text, int r1id, char *r2text, int r2id); |
f7f27309 |
198 | |
199 | /* |
200 | * Exports from windlg.c. |
201 | */ |
202 | void defuse_showwindow(void); |
203 | int do_config(void); |
204 | int do_reconfig(HWND); |
f7f27309 |
205 | void showeventlog(HWND); |
206 | void showabout(HWND); |
f7f27309 |
207 | void force_normal(HWND hwnd); |
208 | |
f7f27309 |
209 | /* |
210 | * Exports from sizetip.c. |
211 | */ |
212 | void UpdateSizeTip(HWND src, int cx, int cy); |
213 | void EnableSizeTip(int bEnable); |
214 | |
facd762c |
215 | /* |
216 | * Exports from unicode.c. |
217 | */ |
07b2a9cd |
218 | struct unicode_data; |
21d2b241 |
219 | void init_ucs(Config *, struct unicode_data *); |
facd762c |
220 | |
f7f27309 |
221 | #endif |