comparison src/console-msw.h @ 428:3ecd8885ac67 r21-2-22

Import from CVS: tag r21-2-22
author cvs
date Mon, 13 Aug 2007 11:28:15 +0200
parents
children a5df635868b2
comparison
equal deleted inserted replaced
427:0a0253eac470 428:3ecd8885ac67
1 /* Define mswindows-specific console, device, and frame object for XEmacs.
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.
29 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0.
30 */
31
32 #ifndef _XEMACS_CONSOLE_MSW_H_
33 #define _XEMACS_CONSOLE_MSW_H_
34
35 #include "console.h"
36 #ifdef CONST /* I suspect this is safe */
37 #undef CONST
38 #endif
39 #include <windows.h>
40 #include <ddeml.h> /* DDE management library */
41 #if !defined(__CYGWIN32__) && !defined(__MINGW32__)
42 #include <shellapi.h> /* FileManager/Explorer drag and drop */
43 #include <commctrl.h>
44 #endif
45
46 #ifdef HAVE_XPM
47 #include <X11/xpm.h>
48 #endif
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 #define XEMACS_CONTROL_CLASS "XEmacsControl"
70
71 /*
72 * Console
73 */
74
75 DECLARE_CONSOLE_TYPE (mswindows);
76
77 struct mswindows_console
78 {
79 int infd, outfd;
80 };
81
82
83 /*
84 * Device
85 */
86
87 #define MSW_FONTSIZE (LF_FACESIZE*4+12)
88
89 struct mswindows_font_enum
90 {
91 char fontname[MSW_FONTSIZE];
92 struct mswindows_font_enum *next;
93 };
94
95 struct mswindows_device
96 {
97 int logpixelsx, logpixelsy;
98 int planes, cells;
99 int horzres, vertres; /* Size in pixels */
100 int horzsize, vertsize; /* Size in mm */
101 int bitspixel;
102 struct mswindows_font_enum *fontlist;
103 };
104
105 #define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows)
106 #define DEVICE_MSWINDOWS_LOGPIXELSX(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsx)
107 #define DEVICE_MSWINDOWS_LOGPIXELSY(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsy)
108 #define DEVICE_MSWINDOWS_PLANES(d) (DEVICE_MSWINDOWS_DATA (d)->planes)
109 #define DEVICE_MSWINDOWS_CELLS(d) (DEVICE_MSWINDOWS_DATA (d)->cells)
110 #define DEVICE_MSWINDOWS_HORZRES(d) (DEVICE_MSWINDOWS_DATA (d)->horzres)
111 #define DEVICE_MSWINDOWS_VERTRES(d) (DEVICE_MSWINDOWS_DATA (d)->vertres)
112 #define DEVICE_MSWINDOWS_HORZSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->horzsize)
113 #define DEVICE_MSWINDOWS_VERTSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->vertsize)
114 #define DEVICE_MSWINDOWS_BITSPIXEL(d) (DEVICE_MSWINDOWS_DATA (d)->bitspixel)
115 #define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist)
116
117
118 /*
119 * Frame
120 */
121 typedef struct
122 {
123 int left;
124 int top;
125 int width;
126 int height;
127 } XEMACS_RECT_WH;
128
129 struct mswindows_frame
130 {
131 /* win32 window handle */
132 HWND hwnd;
133
134 /* DC for this win32 window */
135 HDC hdc;
136
137 /* compatible DC for bitmap operations */
138 HDC cdc;
139
140 /* Time of last click event, for button 2 emul */
141 DWORD last_click_time;
142
143 /* Coordinates of last click event, screen-relative */
144 POINTS last_click_point;
145 #ifdef HAVE_TOOLBARS
146 /* Toolbar hash table. See toolbar-msw.c */
147 Lisp_Object toolbar_hash_table;
148 unsigned int toolbar_checksum[4];
149 #endif
150
151 /* Menu hash table. See menubar-msw.c */
152 Lisp_Object menu_hash_table;
153
154 /* Menu checksum. See menubar-msw.c */
155 unsigned int menu_checksum;
156
157 /* Widget glyphs attached to this frame. See glyphs-msw.c */
158 Lisp_Object widget_hash_table;
159
160 /* Frame title hash value. See frame-msw.c */
161 unsigned int title_checksum;
162
163 /* Real character width and height of the frame.
164 FRAME_{HEIGHT,WIDTH} do not work for pixel geometry! */
165 int charheight, charwidth;
166
167 /* Misc flags */
168 int button2_need_lbutton : 1;
169 int button2_need_rbutton : 1;
170 int button2_is_down : 1;
171 int ignore_next_lbutton_up : 1;
172 int ignore_next_rbutton_up : 1;
173 int sizing : 1;
174
175 /* Geometry, in characters, as specified by proplist during frame
176 creation. Memebers are set to -1 for unspecified */
177 XEMACS_RECT_WH* target_rect;
178 };
179
180 #define FRAME_MSWINDOWS_DATA(f) FRAME_TYPE_DATA (f, mswindows)
181
182 #define FRAME_MSWINDOWS_HANDLE(f) (FRAME_MSWINDOWS_DATA (f)->hwnd)
183 #define FRAME_MSWINDOWS_DC(f) (FRAME_MSWINDOWS_DATA (f)->hdc)
184 #define FRAME_MSWINDOWS_CDC(f) (FRAME_MSWINDOWS_DATA (f)->cdc)
185 #define FRAME_MSWINDOWS_MENU_HASH_TABLE(f) (FRAME_MSWINDOWS_DATA (f)->menu_hash_table)
186 #define FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE(f) \
187 (FRAME_MSWINDOWS_DATA (f)->toolbar_hash_table)
188 #define FRAME_MSWINDOWS_WIDGET_HASH_TABLE(f) \
189 (FRAME_MSWINDOWS_DATA (f)->widget_hash_table)
190 #define FRAME_MSWINDOWS_TOOLBAR_CHECKSUM(f,pos) \
191 (FRAME_MSWINDOWS_DATA (f)->toolbar_checksum[pos])
192 #define FRAME_MSWINDOWS_MENU_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->menu_checksum)
193 #define FRAME_MSWINDOWS_TITLE_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->title_checksum)
194 #define FRAME_MSWINDOWS_CHARWIDTH(f) (FRAME_MSWINDOWS_DATA (f)->charwidth)
195 #define FRAME_MSWINDOWS_CHARHEIGHT(f) (FRAME_MSWINDOWS_DATA (f)->charheight)
196 #define FRAME_MSWINDOWS_TARGET_RECT(f) (FRAME_MSWINDOWS_DATA (f)->target_rect)
197
198 /* Frame check and validation macros */
199 #define FRAME_MSWINDOWS_P(frm) CONSOLE_TYPESYM_MSWINDOWS_P (FRAME_TYPE (frm))
200 #define CHECK_MSWINDOWS_FRAME(z) CHECK_FRAME_TYPE (z, mswindows)
201 #define CONCHECK_MSWINDOWS_FRAME(z) CONCHECK_FRAME_TYPE (z, mswindows)
202
203 /* win32 window LONG indices */
204 #define XWL_FRAMEOBJ 0
205 #define XWL_COUNT 1 /* Number of LONGs that we use */
206 #define MSWINDOWS_WINDOW_EXTRA_BYTES (XWL_COUNT*4)
207
208
209 /*
210 * Events
211 */
212
213 /* win32 messages / magic event types */
214 #define EVENT_MSWINDOWS_MAGIC_TYPE(e) \
215 ((e)->event.magic.underlying_mswindows_event)
216 #define XM_BUMPQUEUE (WM_USER + 101)
217 #define XM_MAPFRAME (WM_USER + 102)
218 #define XM_UNMAPFRAME (WM_USER + 103)
219
220
221 /*
222 * Random globals
223 */
224
225 /* win32 "Windows" procedure */
226 LRESULT WINAPI mswindows_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam,
227 LPARAM lParam);
228 LRESULT WINAPI mswindows_control_wnd_proc (HWND hwnd,
229 UINT msg, WPARAM wParam,
230 LPARAM lParam);
231
232 void mswindows_redraw_exposed_area (struct frame *f, int x, int y,
233 int width, int height);
234 void mswindows_size_frame_internal (struct frame* f, XEMACS_RECT_WH* dest);
235 void mswindows_enqueue_magic_event (HWND hwnd, UINT message);
236
237 /* win32 DDE management library */
238 #define MSWINDOWS_DDE_ITEM_OPEN "Open"
239 extern DWORD mswindows_dde_mlid;
240 extern HSZ mswindows_dde_service;
241 extern HSZ mswindows_dde_topic_system;
242 extern HSZ mswindows_dde_item_open;
243 HDDEDATA CALLBACK mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv,
244 HSZ hszTopic, HSZ hszItem, HDDEDATA hdata,
245 DWORD dwData1, DWORD dwData2);
246
247 void mswindows_enqueue_misc_user_event (Lisp_Object channel,
248 Lisp_Object function,
249 Lisp_Object object);
250 Lisp_Object mswindows_cancel_dispatch_event (struct Lisp_Event* event);
251 Lisp_Object mswindows_pump_outstanding_events (void);
252 Lisp_Object mswindows_protect_modal_loop (Lisp_Object (*bfun) (Lisp_Object barg),
253 Lisp_Object barg);
254 void mswindows_unmodalize_signal_maybe (void);
255
256 #ifdef HAVE_WIN32_PROCESSES
257 HANDLE get_nt_process_handle (struct Lisp_Process *p);
258 #endif
259
260 extern Lisp_Object Vmswindows_frame_being_created;
261 extern Lisp_Object mswindows_frame_being_created;
262
263 void mswindows_enumerate_fonts (struct device *d);
264
265 #endif /* _XEMACS_CONSOLE_MSW_H_ */