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. */
81 /* mmsystem.h defines. */
86 #define SND_NODEFAULT 2
92 #define SND_FILENAME 0x2000L
95 /* winspool.h defines. */
97 #define PHYSICALWIDTH 110
99 #ifndef PHYSICALHEIGHT
100 #define PHYSICALHEIGHT 111
102 #ifndef PHYSICALOFFSETX
103 #define PHYSICALOFFSETX 112
105 #ifndef PHYSICALOFFSETY
106 #define PHYSICALOFFSETY 113
109 /* windows.h defines. */
110 #if defined (CYGWIN) && (CYGWIN_VERSION_DLL_MAJOR < 20)
111 typedef NMHDR *LPNMHDR;
114 #ifndef SPI_GETWHEELSCROLLLINES
115 #define SPI_GETWHEELSCROLLLINES 104
117 #ifndef WHEEL_PAGESCROLL
118 #define WHEEL_PAGESCROLL (UINT_MAX)
121 #define WHEEL_DELTA 120
123 #ifndef WM_MOUSEWHEEL
124 #define WM_MOUSEWHEEL 0x20A
130 #define SIF_TRACKPOS 0x0010
133 #define FW_BLACK FW_HEAVY
136 #define FW_ULTRABOLD FW_EXTRABOLD
139 #define FW_DEMIBOLD FW_SEMIBOLD
141 #ifndef FW_ULTRALIGHT
142 #define FW_ULTRALIGHT FW_EXTRALIGHT
144 #ifndef APPCMD_FILTERINITS
145 #define APPCMD_FILTERINITS 0x20L
147 #ifndef CBF_FAIL_SELFCONNECTIONS
148 #define CBF_FAIL_SELFCONNECTIONS 0x1000
150 #ifndef CBF_SKIP_ALLNOTIFICATIONS
151 #define CBF_SKIP_ALLNOTIFICATIONS 0x3C0000
153 #ifndef CBF_FAIL_ADVISES
154 #define CBF_FAIL_ADVISES 0x4000
156 #ifndef CBF_FAIL_POKES
157 #define CBF_FAIL_POKES 0x10000
159 #ifndef CBF_FAIL_REQUESTS
160 #define CBF_FAIL_REQUESTS 0x20000
162 #ifndef SZDDESYS_TOPIC
163 #define SZDDESYS_TOPIC "System"
165 #ifndef JOHAB_CHARSET
166 #define JOHAB_CHARSET 130
169 #define MAC_CHARSET 77
172 /***************************************************************/
174 /* Definitions for Mule under MS Windows */
180 /* All but wcscmp and wcslen left out of Cygwin headers -- but present
181 in /usr/include/mingw32/string.h! */
182 wchar_t* wcscat (wchar_t*, const wchar_t*);
183 wchar_t* wcschr (const wchar_t*, wchar_t);
184 int wcscoll (const wchar_t*, const wchar_t*);
185 wchar_t* wcscpy (wchar_t*, const wchar_t*);
186 size_t wcscspn (const wchar_t*, const wchar_t*);
187 /* Note: No wcserror in CRTDLL. */
188 wchar_t* wcsncat (wchar_t*, const wchar_t*, size_t);
189 int wcsncmp(const wchar_t*, const wchar_t*, size_t);
190 wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
191 wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
192 wchar_t* wcsrchr(const wchar_t*, wchar_t);
193 size_t wcsspn(const wchar_t*, const wchar_t*);
194 wchar_t* wcsstr(const wchar_t*, const wchar_t*);
195 wchar_t* wcstok(wchar_t*, const wchar_t*);
196 size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
200 // extern int mswindows_windows9x_p;
201 /* #define XEUNICODE_P (!mswindows_windows9x_p) */
202 #define XEUNICODE_P 0
204 #define XETCHAR_SIZE (XEUNICODE_P ? sizeof (WCHAR) : sizeof (CHAR))
205 #define MAX_XETCHAR_SIZE sizeof (WCHAR)
206 #define XETEXT1(arg) (XEUNICODE_P ? ((char *) (L##arg)) : (arg))
207 /* We need to do this indirection in case ARG is also a manifest constant.
208 I don't really understand why. --ben */
209 #define XETEXT(arg) XETEXT1(arg)
210 #define XECOPY_TCHAR(ptr, ch) \
211 (XEUNICODE_P ? (* (LPWSTR) (ptr) = L##ch) : (* (LPSTR) (ptr) = (ch)))
212 #define xetcslen(arg) (XEUNICODE_P ? wcslen ((wchar_t *) arg) : strlen (arg))
213 #define xetcscmp(s1, s2) \
214 (XEUNICODE_P ? wcscmp ((wchar_t *) s1, (wchar_t *) s2) \
216 #define xetcscpy(s1, s2) \
217 (XEUNICODE_P ? (char *) wcscpy ((wchar_t *) s1, (wchar_t *) s2) \
219 #define xetcschr(s, ch) \
220 (XEUNICODE_P ? (char *) wcschr ((wchar_t *) s, (WCHAR) ch) \
222 #define xetcsrchr(s, ch) \
223 (XEUNICODE_P ? (char *) wcsrchr ((wchar_t *) s, (WCHAR) ch) \
227 #define LOCAL_FILE_FORMAT_TO_TSTR(path, out) \
231 LOCAL_TO_WIN32_FILE_FORMAT (path, lttff); \
232 C_STRING_TO_EXTERNAL (lttff, out, Qmswindows_tstr); \
235 Lisp_Object tstr_to_local_file_format (Extbyte *pathout);
238 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
240 Lisp_Object ltwff1 = (path); \
242 cygwin_posix_to_win32_path_list_buf_size (XSTRING_DATA (ltwff1)); \
243 pathout = (Bufbyte *) alloca (ltwff2); \
244 cygwin_posix_to_win32_path_list (XSTRING_DATA (ltwff1), pathout); \
247 #define LOCAL_TO_WIN32_FILE_FORMAT(path, pathout) \
249 (pathout) = XSTRING_DATA (path); \
254 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
256 Bufbyte *wtlff1 = (path); \
258 cygwin_win32_to_posix_path_list_buf_size (wtlff1); \
259 Bufbyte *wtlff3 = (Bufbyte *) alloca (wtlff2); \
260 cygwin_win32_to_posix_path_list (wtlff1, wtlff3); \
261 (pathout) = build_string (wtlff3); \
264 #define WIN32_TO_LOCAL_FILE_FORMAT(path, pathout) \
266 (pathout) = build_string (path); \
270 extern BOOL (WINAPI *xSwitchToThread) (VOID);
272 extern HKL (WINAPI *xGetKeyboardLayout) (DWORD);
273 extern BOOL (WINAPI *xSetMenuDefaultItem) (HMENU, UINT, UINT);
274 extern BOOL (WINAPI *xInsertMenuItemA) (HMENU, UINT, BOOL, LPCMENUITEMINFOA);
275 extern BOOL (WINAPI *xInsertMenuItemW) (HMENU, UINT, BOOL, LPCMENUITEMINFOW);
276 extern HANDLE (WINAPI *xLoadImageA) (HINSTANCE, LPCSTR, UINT, int, int, UINT);
277 extern HANDLE (WINAPI *xLoadImageW) (HINSTANCE, LPCWSTR, UINT, int, int, UINT);
278 extern ATOM (WINAPI *xRegisterClassExA) (CONST WNDCLASSEXA *);
279 extern ATOM (WINAPI *xRegisterClassExW) (CONST WNDCLASSEXW *);
281 extern int (WINAPI *xEnumFontFamiliesExA) (HDC, LPLOGFONTA, FONTENUMPROCA,
283 extern int (WINAPI *xEnumFontFamiliesExW) (HDC, LPLOGFONTW, FONTENUMPROCW,
286 extern DWORD (WINAPI *xSHGetFileInfoA) (LPCSTR, DWORD, SHFILEINFOA FAR *, UINT,
288 extern DWORD (WINAPI *xSHGetFileInfoW) (LPCWSTR, DWORD, SHFILEINFOW FAR *,
291 #endif /* INCLUDED_syswindows_h_ */