249
|
1 /* Define mswindows-specific console, device, and frame object for XEmacs.
|
213
|
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not in FSF. */
|
|
23
|
|
24
|
|
25 /* Authorship:
|
|
26
|
|
27 Ultimately based on FSF, then later on JWZ work for Lemacs.
|
|
28 Rewritten over time by Ben Wing and Chuck Thompson.
|
272
|
29 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0.
|
213
|
30 */
|
|
31
|
|
32 #ifndef _XEMACS_CONSOLE_MSW_H_
|
|
33 #define _XEMACS_CONSOLE_MSW_H_
|
|
34
|
|
35 #include "console.h"
|
251
|
36 #ifdef CONST /* I suspect this is safe */
|
|
37 #undef CONST
|
|
38 #endif
|
286
|
39 #include <windows.h>
|
|
40 #include <ddeml.h> /* DDE management library */
|
251
|
41 #ifndef __CYGWIN32__
|
286
|
42 #include <shellapi.h> /* FileManager/Explorer drag and drop */
|
|
43 #include <commctrl.h>
|
276
|
44 #endif
|
|
45
|
|
46 #ifdef HAVE_XPM
|
|
47 #include <X11/xpm.h>
|
251
|
48 #endif
|
249
|
49
|
|
50 /*
|
|
51 * XXX FIXME: The following X modifier defs in events-mod.h clash with win32
|
|
52 * hotkey defs in winuser.h. For the moment lose the win32 versions.
|
|
53 * Maybe we should rename all of MOD_* to something that doesn't clash.
|
|
54 */
|
|
55 #ifdef MOD_CONTROL
|
|
56 # undef MOD_CONTROL
|
|
57 #endif
|
|
58 #ifdef MOD_ALT
|
|
59 # undef MOD_ALT
|
|
60 #endif
|
|
61 #ifdef MOD_SHIFT
|
|
62 # undef MOD_SHIFT
|
|
63 #endif
|
|
64
|
|
65
|
|
66 /* The name of the main window class */
|
|
67 #define XEMACS_CLASS "XEmacs"
|
|
68
|
|
69
|
|
70 /*
|
|
71 * Console
|
|
72 */
|
213
|
73
|
|
74 DECLARE_CONSOLE_TYPE (mswindows);
|
|
75
|
|
76 struct mswindows_console
|
|
77 {
|
|
78 int infd, outfd;
|
|
79 };
|
|
80
|
|
81
|
249
|
82 /*
|
|
83 * Device
|
|
84 */
|
|
85
|
294
|
86 #define MSW_FONTSIZE (LF_FACESIZE*4+12)
|
|
87
|
|
88 struct mswindows_font_enum
|
|
89 {
|
|
90 char fontname[MSW_FONTSIZE];
|
|
91 struct mswindows_font_enum *next;
|
|
92 };
|
|
93
|
213
|
94 struct mswindows_device
|
|
95 {
|
|
96 int logpixelsx, logpixelsy;
|
|
97 int planes, cells;
|
|
98 int horzres, vertres; /* Size in pixels */
|
|
99 int horzsize, vertsize; /* Size in mm */
|
267
|
100 int bitspixel;
|
294
|
101 struct mswindows_font_enum *fontlist;
|
213
|
102 };
|
|
103
|
|
104 #define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows)
|
|
105 #define DEVICE_MSWINDOWS_LOGPIXELSX(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsx)
|
|
106 #define DEVICE_MSWINDOWS_LOGPIXELSY(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsy)
|
|
107 #define DEVICE_MSWINDOWS_PLANES(d) (DEVICE_MSWINDOWS_DATA (d)->planes)
|
|
108 #define DEVICE_MSWINDOWS_CELLS(d) (DEVICE_MSWINDOWS_DATA (d)->cells)
|
|
109 #define DEVICE_MSWINDOWS_HORZRES(d) (DEVICE_MSWINDOWS_DATA (d)->horzres)
|
|
110 #define DEVICE_MSWINDOWS_VERTRES(d) (DEVICE_MSWINDOWS_DATA (d)->vertres)
|
|
111 #define DEVICE_MSWINDOWS_HORZSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->horzsize)
|
|
112 #define DEVICE_MSWINDOWS_VERTSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->vertsize)
|
267
|
113 #define DEVICE_MSWINDOWS_BITSPIXEL(d) (DEVICE_MSWINDOWS_DATA (d)->bitspixel)
|
294
|
114 #define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist)
|
213
|
115
|
|
116
|
249
|
117 /*
|
|
118 * Frame
|
|
119 */
|
294
|
120 typedef struct
|
|
121 {
|
|
122 int left;
|
|
123 int top;
|
|
124 int width;
|
|
125 int height;
|
|
126 } XEMACS_RECT_WH;
|
249
|
127
|
213
|
128 struct mswindows_frame
|
|
129 {
|
|
130 /* win32 window handle */
|
|
131 HWND hwnd;
|
|
132
|
|
133 /* DC for this win32 window */
|
|
134 HDC hdc;
|
223
|
135
|
269
|
136 /* compatibke DC for bitmap operations */
|
|
137 HDC cdc;
|
|
138
|
223
|
139 /* Time of last click event, for button 2 emul */
|
|
140 DWORD last_click_time;
|
|
141
|
|
142 /* Coordinates of last click event, screen-relative */
|
|
143 POINTS last_click_point;
|
276
|
144 #ifdef HAVE_TOOLBARS
|
|
145 /* Toolbar hashtable. See toolbar-msw.c */
|
|
146 Lisp_Object toolbar_hashtable;
|
278
|
147 unsigned int toolbar_checksum[4];
|
276
|
148 #endif
|
223
|
149
|
233
|
150 /* Menu hashtable. See menubar-msw.c */
|
|
151 Lisp_Object menu_hashtable;
|
|
152
|
|
153 /* Menu checksum. See menubar-msw.c */
|
|
154 unsigned int menu_checksum;
|
231
|
155
|
274
|
156 /* Frame title hash value. See frame-msw.c */
|
|
157 unsigned int title_checksum;
|
|
158
|
269
|
159 /* Real character width and height of the frame.
|
|
160 FRAME_{HEIGHT,WIDTH} do not work for pixel geometry! */
|
|
161 int charheight, charwidth;
|
|
162
|
223
|
163 /* Misc flags */
|
|
164 int button2_need_lbutton : 1;
|
|
165 int button2_need_rbutton : 1;
|
|
166 int button2_is_down : 1;
|
|
167 int ignore_next_lbutton_up : 1;
|
|
168 int ignore_next_rbutton_up : 1;
|
|
169 int sizing : 1;
|
294
|
170
|
|
171 /* Geometry, in characters, as specified by proplist during frame
|
|
172 creation. Memebers are set to -1 for unspecified */
|
|
173 XEMACS_RECT_WH* target_rect;
|
213
|
174 };
|
|
175
|
|
176 #define FRAME_MSWINDOWS_DATA(f) FRAME_TYPE_DATA (f, mswindows)
|
|
177
|
233
|
178 #define FRAME_MSWINDOWS_HANDLE(f) (FRAME_MSWINDOWS_DATA (f)->hwnd)
|
|
179 #define FRAME_MSWINDOWS_DC(f) (FRAME_MSWINDOWS_DATA (f)->hdc)
|
272
|
180 #define FRAME_MSWINDOWS_CDC(f) (FRAME_MSWINDOWS_DATA (f)->cdc)
|
233
|
181 #define FRAME_MSWINDOWS_MENU_HASHTABLE(f) (FRAME_MSWINDOWS_DATA (f)->menu_hashtable)
|
278
|
182 #define FRAME_MSWINDOWS_TOOLBAR_HASHTABLE(f) \
|
|
183 (FRAME_MSWINDOWS_DATA (f)->toolbar_hashtable)
|
|
184 #define FRAME_MSWINDOWS_TOOLBAR_CHECKSUM(f,pos) \
|
|
185 (FRAME_MSWINDOWS_DATA (f)->toolbar_checksum[pos])
|
233
|
186 #define FRAME_MSWINDOWS_MENU_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->menu_checksum)
|
274
|
187 #define FRAME_MSWINDOWS_TITLE_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->title_checksum)
|
|
188 #define FRAME_MSWINDOWS_CHARWIDTH(f) (FRAME_MSWINDOWS_DATA (f)->charwidth)
|
|
189 #define FRAME_MSWINDOWS_CHARHEIGHT(f) (FRAME_MSWINDOWS_DATA (f)->charheight)
|
294
|
190 #define FRAME_MSWINDOWS_TARGET_RECT(f) (FRAME_MSWINDOWS_DATA (f)->target_rect)
|
269
|
191
|
|
192 /* Frame check and validation macros */
|
|
193 #define FRAME_MSWINDOWS_P(frm) CONSOLE_TYPESYM_MSWINDOWS_P (FRAME_TYPE (frm))
|
|
194 #define CHECK_MSWINDOWS_FRAME(z) CHECK_FRAME_TYPE (z, mswindows)
|
|
195 #define CONCHECK_MSWINDOWS_FRAME(z) CONCHECK_FRAME_TYPE (z, mswindows)
|
213
|
196
|
249
|
197 /* win32 window LONG indices */
|
|
198 #define XWL_FRAMEOBJ 0
|
|
199 #define XWL_COUNT 1 /* Number of LONGs that we use */
|
|
200 #define MSWINDOWS_WINDOW_EXTRA_BYTES (XWL_COUNT*4)
|
|
201
|
|
202
|
213
|
203 /*
|
249
|
204 * Events
|
|
205 */
|
|
206
|
|
207 /* win32 messages / magic event types */
|
|
208 #define EVENT_MSWINDOWS_MAGIC_TYPE(e) \
|
|
209 ((e)->event.magic.underlying_mswindows_event)
|
|
210 #define XM_BUMPQUEUE (WM_USER + 101)
|
|
211 #define XM_MAPFRAME (WM_USER + 102)
|
|
212 #define XM_UNMAPFRAME (WM_USER + 103)
|
|
213
|
|
214
|
|
215 /*
|
|
216 * Random globals
|
213
|
217 */
|
249
|
218
|
|
219 /* win32 "Windows" procedure */
|
|
220 LRESULT WINAPI mswindows_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam,
|
|
221 LPARAM lParam);
|
|
222
|
213
|
223 void mswindows_redraw_exposed_area (struct frame *f, int x, int y,
|
249
|
224 int width, int height);
|
294
|
225 void mswindows_size_frame_internal (struct frame* f, XEMACS_RECT_WH* dest);
|
298
|
226 void mswindows_enqueue_magic_event (HWND hwnd, UINT message);
|
249
|
227
|
|
228 /* win32 DDE management library */
|
|
229 #define MSWINDOWS_DDE_ITEM_OPEN "Open"
|
|
230 extern DWORD mswindows_dde_mlid;
|
|
231 extern HSZ mswindows_dde_service;
|
|
232 extern HSZ mswindows_dde_topic_system;
|
|
233 extern HSZ mswindows_dde_item_open;
|
|
234 HDDEDATA CALLBACK mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv,
|
|
235 HSZ hszTopic, HSZ hszItem, HDDEDATA hdata,
|
|
236 DWORD dwData1, DWORD dwData2);
|
|
237
|
288
|
238 void mswindows_enqueue_misc_user_event (Lisp_Object channel,
|
|
239 Lisp_Object function,
|
|
240 Lisp_Object object);
|
249
|
241 Lisp_Object mswindows_cancel_dispatch_event (struct Lisp_Event* event);
|
|
242 Lisp_Object mswindows_pump_outstanding_events (void);
|
269
|
243 Lisp_Object mswindows_protect_modal_loop (Lisp_Object (*bfun) (Lisp_Object barg),
|
|
244 Lisp_Object barg);
|
|
245 void mswindows_unmodalize_signal_maybe (void);
|
|
246
|
276
|
247 #ifdef HAVE_WIN32_PROCESSES
|
|
248 HANDLE get_nt_process_handle (struct Lisp_Process *p);
|
|
249 #endif
|
|
250
|
|
251 extern Lisp_Object Vmswindows_frame_being_created;
|
269
|
252 extern Lisp_Object mswindows_frame_being_created;
|
213
|
253
|
|
254 #endif /* _XEMACS_CONSOLE_MSW_H_ */
|