comparison src/syswindows.h @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents
children 0493e9f3c27f
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 Copyright (C) 2000 Ben Wing.
3
4 This file is part of XEmacs.
5
6 XEmacs is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
10
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* Synched up with: Not in FSF. */
22
23 /* Authorship:
24
25 Created May 2000 by Andy Piper.
26 Windows-Mule stuff added by Ben Wing.
27 */
28
29 #ifndef INCLUDED_syswindows_h_
30 #define INCLUDED_syswindows_h_
31
32 /* Note that there are currently FOUR different general
33 Windows-related include files in src!
34
35 Uses are approximately:
36
37 syswindows.h: Mostly a wrapper around <windows.h>, including missing
38 defines as necessary. Also includes stuff needed on both Cygwin and
39 native Windows, regardless of window system chosen.
40
41 console-msw.h: Used on both Cygwin and native Windows, but only when
42 native window system (as opposed to X) chosen.
43
44 nt.h: [will be renamed to win32.h] Used only on native Windows, and
45 regardless of window system chosen -- but used on both purely native
46 Windows (s/windowsnt.h) and MinGW (s/mingw32.h).
47
48 ntheap.h: Used only on native Windows and only when standard dumping
49 mechanism (unexnt.c) used.
50
51 All of the last three files include the first.
52 */
53
54 #ifndef WIN32_LEAN_AND_MEAN
55 #define WIN32_LEAN_AND_MEAN
56 #endif
57
58 #include <windows.h>
59
60 #if (defined (CYGWIN) || defined(MINGW)) && \
61 CYGWIN_VERSION_DLL_MAJOR < 21
62 extern BOOL WINAPI DdeFreeStringHandle(DWORD,HSZ);
63 extern BOOL WINAPI PlaySound(LPCSTR,HMODULE,DWORD);
64 #define stricmp strcasecmp
65 #define FONTENUMPROC FONTENUMEXPROC
66 #define ntmTm ntmentm
67 #elif defined (WIN32_LEAN_AND_MEAN)
68 #ifdef HAVE_X_WINDOWS
69 /* Christ almighty. The problems you get when combining two large code bases,
70 neither with any respect for namespace purity. */
71 #undef Status
72 #endif
73 #include <winspool.h>
74 #ifdef HAVE_X_WINDOWS
75 #define Status int
76 #endif
77 #include <mmsystem.h>
78 #include <shellapi.h>
79 #include <ddeml.h>
80 #endif
81
82 /* mmsystem.h defines. */
83 #ifndef SND_ASYNC
84 #define SND_ASYNC 1
85 #endif
86 #ifndef SND_NODEFAULT
87 #define SND_NODEFAULT 2
88 #endif
89 #ifndef SND_MEMORY
90 #define SND_MEMORY 4
91 #endif
92 #ifndef SND_FILENAME
93 #define SND_FILENAME 0x2000L
94 #endif
95
96 /* winspool.h defines. */
97 #ifndef PHYSICALWIDTH
98 #define PHYSICALWIDTH 110
99 #endif
100 #ifndef PHYSICALHEIGHT
101 #define PHYSICALHEIGHT 111
102 #endif
103 #ifndef PHYSICALOFFSETX
104 #define PHYSICALOFFSETX 112
105 #endif
106 #ifndef PHYSICALOFFSETY
107 #define PHYSICALOFFSETY 113
108 #endif
109
110 /* windows.h defines. */
111 #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_MAJOR < 20)
112 typedef NMHDR *LPNMHDR;
113 #endif
114
115 #ifndef SPI_GETWHEELSCROLLLINES
116 #define SPI_GETWHEELSCROLLLINES 104
117 #endif
118 #ifndef WHEEL_PAGESCROLL
119 #define WHEEL_PAGESCROLL (UINT_MAX)
120 #endif
121 #ifndef WHEEL_DELTA
122 #define WHEEL_DELTA 120
123 #endif
124 #ifndef WM_MOUSEWHEEL
125 #define WM_MOUSEWHEEL 0x20A
126 #endif
127 #ifndef VK_APPS
128 #define VK_APPS 0x5D
129 #endif
130 #ifndef SIF_TRACKPOS
131 #define SIF_TRACKPOS 0x0010
132 #endif
133 #ifndef FW_BLACK
134 #define FW_BLACK FW_HEAVY
135 #endif
136 #ifndef FW_ULTRABOLD
137 #define FW_ULTRABOLD FW_EXTRABOLD
138 #endif
139 #ifndef FW_DEMIBOLD
140 #define FW_DEMIBOLD FW_SEMIBOLD
141 #endif
142 #ifndef FW_ULTRALIGHT
143 #define FW_ULTRALIGHT FW_EXTRALIGHT
144 #endif
145 #ifndef APPCMD_FILTERINITS
146 #define APPCMD_FILTERINITS 0x20L
147 #endif
148 #ifndef CBF_FAIL_SELFCONNECTIONS
149 #define CBF_FAIL_SELFCONNECTIONS 0x1000
150 #endif
151 #ifndef CBF_SKIP_ALLNOTIFICATIONS
152 #define CBF_SKIP_ALLNOTIFICATIONS 0x3C0000
153 #endif
154 #ifndef CBF_FAIL_ADVISES
155 #define CBF_FAIL_ADVISES 0x4000
156 #endif
157 #ifndef CBF_FAIL_POKES
158 #define CBF_FAIL_POKES 0x10000
159 #endif
160 #ifndef CBF_FAIL_REQUESTS
161 #define CBF_FAIL_REQUESTS 0x20000
162 #endif
163 #ifndef SZDDESYS_TOPIC
164 #define SZDDESYS_TOPIC "System"
165 #endif
166 #ifndef JOHAB_CHARSET
167 #define JOHAB_CHARSET 130
168 #endif
169 #ifndef MAC_CHARSET
170 #define MAC_CHARSET 77
171 #endif
172
173 /***************************************************************/
174
175 /* Definitions for Mule under MS Windows */
176
177 #include <wchar.h>
178
179 #ifdef CYGWIN
180
181 /* All but wcscmp and wcslen left out of Cygwin headers -- but present
182 in /usr/include/mingw32/string.h! */
183 wchar_t* wcscat (wchar_t*, const wchar_t*);
184 wchar_t* wcschr (const wchar_t*, wchar_t);
185 int wcscoll (const wchar_t*, const wchar_t*);
186 wchar_t* wcscpy (wchar_t*, const wchar_t*);
187 size_t wcscspn (const wchar_t*, const wchar_t*);
188 /* Note: No wcserror in CRTDLL. */
189 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
190 int wcsncmp(const wchar_t*, const wchar_t*, size_t);
191 wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
192 wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
193 wchar_t* wcsrchr(const wchar_t*, wchar_t);
194 size_t wcsspn(const wchar_t*, const wchar_t*);
195 wchar_t* wcsstr(const wchar_t*, const wchar_t*);
196 wchar_t* wcstok(wchar_t*, const wchar_t*);
197 size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
198
199 #endif /* CYGWIN */
200
201 // extern int mswindows_windows9x_p;
202 /* #define XEUNICODE_P (!mswindows_windows9x_p) */
203 #define XEUNICODE_P 0
204
205 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR))
206 #define MAX_XETCHAR_SIZE sizeof (WCHAR)
207 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg))
208 /* We need to do this indirection in case ARG is also a manifest constant.
209 I don't really understand why. --ben */
210 #define XETEXT(arg) XETEXT1(arg)
211 #define XECOPY_TCHAR(ptr, ch) \
212 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch)))
213 #define xetcslen(arg) (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg))
214 #define xetcscmp(s1, s2) \
215 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \
216 : strcmp (s1, s2))
217 #define xetcscpy(s1, s2) \
218 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \
219 : strcpy (s1, s2))
220 #define xetcschr(s, ch) \
221 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \
222 : strchr (s, ch))
223 #define xetcsrchr(s, ch) \
224 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \
225 : strrchr (s, ch))
226
227
228 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
229 do { \
230 Bufbyte *lttff; \
231 \
232 LOCAL_TO_WIN32_FILE_FORMAT (path, lttff); \
233 C_STRING_TO_EXTERNAL (lttff, out, Qmswindows_tstr); \
234 } while (0)
235
236 Lisp_Object tstr_to_local_file_format (Extbyte *pathout);
237
238 #ifdef CYGWIN
239 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
240 do { \
241 Lisp_Object ltwff1 = (path); \
242 int ltwff2 = \
243 cygwin_posix_to_win32_path_list_buf_size (XSTRING_DATA (ltwff1)); \
244 pathout = (Bufbyte *) alloca (ltwff2); \
245 cygwin_posix_to_win32_path_list (XSTRING_DATA (ltwff1), pathout); \
246 } while (0)
247 #else
248 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
249 do { \
250 (pathout) = XSTRING_DATA (path); \
251 } while (0)
252 #endif
253
254 #ifdef CYGWIN
255 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
256 do { \
257 Bufbyte *wtlff1 = (path); \
258 int wtlff2 = \
259 cygwin_win32_to_posix_path_list_buf_size (wtlff1); \
260 Bufbyte *wtlff3 = (Bufbyte *) alloca (wtlff2); \
261 cygwin_win32_to_posix_path_list (wtlff1, wtlff3); \
262 (pathout) = build_string (wtlff3); \
263 } while (0)
264 #else
265 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
266 do { \
267 (pathout) = build_string (path); \
268 } while (0)
269 #endif
270
271 extern BOOL (WINAPI *xSwitchToThread) (VOID);
272
273 extern HKL (WINAPI *xGetKeyboardLayout) (DWORD);
274 extern BOOL (WINAPI *xSetMenuDefaultItem) (HMENU, UINT, UINT);
275 extern BOOL (WINAPI *xInsertMenuItemA) (HMENU, UINT, BOOL, LPCMENUITEMINFOA);
276 extern BOOL (WINAPI *xInsertMenuItemW) (HMENU, UINT, BOOL, LPCMENUITEMINFOW);
277 extern HANDLE (WINAPI *xLoadImageA) (HINSTANCE, LPCSTR, UINT, int, int, UINT);
278 extern HANDLE (WINAPI *xLoadImageW) (HINSTANCE, LPCWSTR, UINT, int, int, UINT);
279 extern ATOM (WINAPI *xRegisterClassExA) (CONST WNDCLASSEXA *);
280 extern ATOM (WINAPI *xRegisterClassExW) (CONST WNDCLASSEXW *);
281
282 extern int (WINAPI *xEnumFontFamiliesExA) (HDC, LPLOGFONTA, FONTENUMPROCA,
283 LPARAM, DWORD);
284 extern int (WINAPI *xEnumFontFamiliesExW) (HDC, LPLOGFONTW, FONTENUMPROCW,
285 LPARAM, DWORD);
286
287 extern DWORD (WINAPI *xSHGetFileInfoA) (LPCSTR, DWORD, SHFILEINFOA FAR *, UINT,
288 UINT);
289 extern DWORD (WINAPI *xSHGetFileInfoW) (LPCWSTR, DWORD, SHFILEINFOW FAR *,
290 UINT, UINT);
291
292 #endif /* INCLUDED_syswindows_h_ */