1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 Copyright (C) 2000 Ben Wing.
4 This file is part of XEmacs.
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
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
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. */
21 /* Synched up with: Not in FSF. */
25 Created May 2000 by Andy Piper.
26 Windows-Mule stuff added by Ben Wing.
29 #ifndef INCLUDED_syswindows_h_
30 #define INCLUDED_syswindows_h_
32 /* Note that there are currently FOUR different general
33 Windows-related include files in src!
35 Uses are approximately:
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.
41 console-msw.h: Used on both Cygwin and native Windows, but only when
42 native window system (as opposed to X) chosen.
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).
48 ntheap.h: Used only on native Windows and only when standard dumping
49 mechanism (unexnt.c) used.
51 All of the last three files include the first.
54 #ifndef WIN32_LEAN_AND_MEAN
55 #define WIN32_LEAN_AND_MEAN
60 #if defined (CYGWIN) && CYGWIN_VERSION_DLL_MAJOR < 21
61 extern BOOL WINAPI DdeFreeStringHandle(DWORD,HSZ);
62 extern BOOL WINAPI PlaySound(LPCSTR,HMODULE,DWORD);
63 #define stricmp strcasecmp
64 #define FONTENUMPROC FONTENUMEXPROC
66 #elif defined (WIN32_LEAN_AND_MEAN)
68 /* Christ almighty. The problems you get when combining two large code bases,
69 neither with any respect for namespace purity. */
82 /* mmsystem.h defines. */
87 #define SND_NODEFAULT 2
93 #define SND_FILENAME 0x2000L
96 /* winspool.h defines. */
98 #define PHYSICALWIDTH 110
100 #ifndef PHYSICALHEIGHT
101 #define PHYSICALHEIGHT 111
103 #ifndef PHYSICALOFFSETX
104 #define PHYSICALOFFSETX 112
106 #ifndef PHYSICALOFFSETY
107 #define PHYSICALOFFSETY 113
110 /* shlobj.h defines. */
112 #define BIF_EDITBOX 0x10
115 #define BIF_VALIDATE 0x20
117 #ifndef BFFM_VALIDATEFAILED
118 #define BFFM_VALIDATEFAILED 3
121 /* windows.h defines. */
122 #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_MAJOR < 20)
123 typedef NMHDR *LPNMHDR;
126 #ifndef SPI_GETWHEELSCROLLLINES
127 #define SPI_GETWHEELSCROLLLINES 104
129 #ifndef WHEEL_PAGESCROLL
130 #define WHEEL_PAGESCROLL (UINT_MAX)
133 #define WHEEL_DELTA 120
135 #ifndef WM_MOUSEWHEEL
136 #define WM_MOUSEWHEEL 0x20A
142 #define SIF_TRACKPOS 0x0010
145 #define FW_BLACK FW_HEAVY
148 #define FW_ULTRABOLD FW_EXTRABOLD
151 #define FW_DEMIBOLD FW_SEMIBOLD
153 #ifndef FW_ULTRALIGHT
154 #define FW_ULTRALIGHT FW_EXTRALIGHT
156 #ifndef APPCMD_FILTERINITS
157 #define APPCMD_FILTERINITS 0x20L
159 #ifndef CBF_FAIL_SELFCONNECTIONS
160 #define CBF_FAIL_SELFCONNECTIONS 0x1000
162 #ifndef CBF_SKIP_ALLNOTIFICATIONS
163 #define CBF_SKIP_ALLNOTIFICATIONS 0x3C0000
165 #ifndef CBF_FAIL_ADVISES
166 #define CBF_FAIL_ADVISES 0x4000
168 #ifndef CBF_FAIL_POKES
169 #define CBF_FAIL_POKES 0x10000
171 #ifndef CBF_FAIL_REQUESTS
172 #define CBF_FAIL_REQUESTS 0x20000
174 #ifndef SZDDESYS_TOPIC
175 #define SZDDESYS_TOPIC "System"
177 #ifndef JOHAB_CHARSET
178 #define JOHAB_CHARSET 130
181 #define MAC_CHARSET 77
183 #ifndef LOCALE_RETURN_NUMBER
184 #define LOCALE_RETURN_NUMBER 0x20000000
187 /***************************************************************/
189 /* Definitions for Mule under MS Windows */
193 #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_COMBINED < 190)
195 /* All but wcscmp and wcslen left out of Cygwin headers -- but present
196 in /usr/include/mingw32/string.h! */
197 wchar_t* wcscat (wchar_t*, const wchar_t*);
198 wchar_t* wcschr (const wchar_t*, wchar_t);
199 int wcscoll (const wchar_t*, const wchar_t*);
200 wchar_t* wcscpy (wchar_t*, const wchar_t*);
201 size_t wcscspn (const wchar_t*, const wchar_t*);
202 /* Note: No wcserror in CRTDLL. */
203 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
204 int wcsncmp(const wchar_t*, const wchar_t*, size_t);
205 wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
206 wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
207 wchar_t* wcsrchr(const wchar_t*, wchar_t);
208 size_t wcsspn(const wchar_t*, const wchar_t*);
209 wchar_t* wcsstr(const wchar_t*, const wchar_t*);
210 wchar_t* wcstok(wchar_t*, const wchar_t*);
211 size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
215 // extern int mswindows_windows9x_p;
216 /* #define XEUNICODE_P (!mswindows_windows9x_p) */
217 #define XEUNICODE_P 0
219 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR))
220 #define MAX_XETCHAR_SIZE sizeof (WCHAR)
221 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg))
222 /* We need to do this indirection in case ARG is also a manifest constant.
223 I don't really understand why. --ben */
224 #define XETEXT(arg) XETEXT1(arg)
225 #define XECOPY_TCHAR(ptr, ch) \
226 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch)))
227 #define xetcslen(arg) (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg))
228 #define xetcscmp(s1, s2) \
229 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \
231 #define xetcscpy(s1, s2) \
232 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \
234 #define xetcschr(s, ch) \
235 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \
237 #define xetcsrchr(s, ch) \
238 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \
242 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
246 LOCAL_TO_WIN32_FILE_FORMAT (path, lttff); \
247 C_STRING_TO_EXTERNAL (lttff, out, Qmswindows_tstr); \
250 Lisp_Object tstr_to_local_file_format (Extbyte *pathout);
253 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
255 Lisp_Object ltwff1 = (path); \
256 Bufbyte* ltwffp = XSTRING_DATA (ltwff1); \
257 if (isalpha (ltwffp[0]) && (IS_DEVICE_SEP (ltwffp[1]))) \
261 cygwin_posix_to_win32_path_list_buf_size (ltwffp); \
262 pathout = (Bufbyte *) alloca (ltwff2); \
263 cygwin_posix_to_win32_path_list (ltwffp, pathout); \
267 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
269 (pathout) = XSTRING_DATA (path); \
274 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
276 Bufbyte *wtlff1 = (path); \
278 cygwin_win32_to_posix_path_list_buf_size (wtlff1); \
279 Bufbyte *wtlff3 = (Bufbyte *) alloca (wtlff2); \
280 cygwin_win32_to_posix_path_list (wtlff1, wtlff3); \
281 (pathout) = build_string (wtlff3); \
284 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
286 (pathout) = build_string (path); \
290 extern BOOL (WINAPI *xSwitchToThread) (VOID);
292 extern HKL (WINAPI *xGetKeyboardLayout) (DWORD);
293 extern BOOL (WINAPI *xSetMenuDefaultItem) (HMENU, UINT, UINT);
294 extern BOOL (WINAPI *xInsertMenuItemA) (HMENU, UINT, BOOL, LPCMENUITEMINFOA);
295 extern BOOL (WINAPI *xInsertMenuItemW) (HMENU, UINT, BOOL, LPCMENUITEMINFOW);
296 extern HANDLE (WINAPI *xLoadImageA) (HINSTANCE, LPCSTR, UINT, int, int, UINT);
297 extern HANDLE (WINAPI *xLoadImageW) (HINSTANCE, LPCWSTR, UINT, int, int, UINT);
298 extern ATOM (WINAPI *xRegisterClassExA) (CONST WNDCLASSEXA *);
299 extern ATOM (WINAPI *xRegisterClassExW) (CONST WNDCLASSEXW *);
301 extern int (WINAPI *xEnumFontFamiliesExA) (HDC, LPLOGFONTA, FONTENUMPROCA,
303 extern int (WINAPI *xEnumFontFamiliesExW) (HDC, LPLOGFONTW, FONTENUMPROCW,
306 extern DWORD (WINAPI *xSHGetFileInfoA) (LPCSTR, DWORD, SHFILEINFOA FAR *, UINT,
308 extern DWORD (WINAPI *xSHGetFileInfoW) (LPCWSTR, DWORD, SHFILEINFOW FAR *,
311 #endif /* INCLUDED_syswindows_h_ */