Mercurial > emacs
annotate src/w32fns.c @ 15154:bcc66f4bc5ff
Include string.h.
(HAVE_FREXP, HAVE_FMOD): Macros removed.
(struct timeval, struct timezone, gettimeofday): Declarations removed.
(HAVE_SOCKETS, MAIL_USE_POP, MAIL_USE_SYSTEM_LOCK): Macros defined.
(DIRECTORY_SEP): Use Vdirectory_sep_char.
(EXEC_SUFFIXES): Add .cmd to list of suffixes.
(EXEC_SUFFIXES): Add .cmd to list of suffixes.
> (HAVE_SYS_TIMEB_H, HAVE_SYS_TIME_H, HAVE_UNISTD_H, STDC_HEADERS,
TIME_WITH_SYS_TIME, HAVE_GETTIMEOFDAY, HAVE_CLOSEDIR,
HAVE_LONG_FILE_NAMES, HAVE_BCOPY, HAVE_BCMP, HAVE_LOGB, HAVE_FREXP,
HAVE_FMOD, HAVE_FTIME, HAVE_MKTIME, HAVE_H_ERRNO): New macros.
(access, chdir, chmod, close, creat, ctime, dup, dup2, fopen,
link, mkdir, mktemp, open, pipe, read, rename, rmdir, select,
sleep, unlink, write, spawnve, wait, kill, signal):
Macros redefined from win32_* to sys_*.
[__STDC__]: Define when including direct.h, io.h, stdio.h.
(struct nt_stat): Definition removed.
(stat, st_dev, st_ino, st_mode, st_nlink, st_uid, st_gid,
st_rdev, st_size, st_atime, st_mtime, st_ctime): Macros undefined.
author | Geoff Voelker <voelker@cs.washington.edu> |
---|---|
date | Fri, 03 May 1996 18:50:05 +0000 |
parents | 220145cf7546 |
children | 0f5d6cd72e21 |
rev | line source |
---|---|
13434 | 1 /* Functions for the Win32 window system. |
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation. | |
3 | |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
13434 | 20 |
21 /* Added by Kevin Gallo */ | |
22 | |
23 #include <signal.h> | |
24 #include <config.h> | |
25 #include <stdio.h> | |
26 | |
27 #include "lisp.h" | |
28 #include "w32term.h" | |
29 #include "frame.h" | |
30 #include "window.h" | |
31 #include "buffer.h" | |
32 #include "dispextern.h" | |
33 #include "keyboard.h" | |
34 #include "blockinput.h" | |
35 #include "paths.h" | |
36 #include "ntheap.h" | |
37 #include "termhooks.h" | |
38 | |
39 #include <commdlg.h> | |
40 | |
41 extern void abort (); | |
42 extern void free_frame_menubar (); | |
43 extern struct scroll_bar *x_window_to_scroll_bar (); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
44 extern int quit_char; |
13434 | 45 |
46 /* The colormap for converting color names to RGB values */ | |
47 Lisp_Object Vwin32_color_map; | |
48 | |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
49 /* Non nil if alt key presses are passed on to Windows. */ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
50 Lisp_Object Vwin32_pass_alt_to_system; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
51 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
52 /* Non nil if left window, right window, and application key events |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
53 are passed on to Windows. */ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
54 Lisp_Object Vwin32_pass_optional_keys_to_system; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
55 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
56 /* Switch to control whether we inhibit requests for italicised fonts (which |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
57 are synthesized, look ugly, and are trashed by cursor movement under NT). */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
58 Lisp_Object Vwin32_enable_italics; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
59 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
60 /* Enable palette management. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
61 Lisp_Object Vwin32_enable_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
62 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
63 /* Control how close left/right button down events must be to |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
64 be converted to a middle button down event. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
65 Lisp_Object Vwin32_mouse_button_tolerance; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
66 |
13434 | 67 /* The name we're using in resource queries. */ |
68 Lisp_Object Vx_resource_name; | |
69 | |
70 /* Non nil if no window manager is in use. */ | |
71 Lisp_Object Vx_no_window_manager; | |
72 | |
73 /* The background and shape of the mouse pointer, and shape when not | |
74 over text or in the modeline. */ | |
75 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; | |
76 /* The shape when over mouse-sensitive text. */ | |
77 Lisp_Object Vx_sensitive_text_pointer_shape; | |
78 | |
79 /* Color of chars displayed in cursor box. */ | |
80 Lisp_Object Vx_cursor_fore_pixel; | |
81 | |
82 /* Search path for bitmap files. */ | |
83 Lisp_Object Vx_bitmap_file_path; | |
84 | |
85 /* Evaluate this expression to rebuild the section of syms_of_w32fns | |
86 that initializes and staticpros the symbols declared below. Note | |
87 that Emacs 18 has a bug that keeps C-x C-e from being able to | |
88 evaluate this expression. | |
89 | |
90 (progn | |
91 ;; Accumulate a list of the symbols we want to initialize from the | |
92 ;; declarations at the top of the file. | |
93 (goto-char (point-min)) | |
94 (search-forward "/\*&&& symbols declared here &&&*\/\n") | |
95 (let (symbol-list) | |
96 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)") | |
97 (setq symbol-list | |
98 (cons (buffer-substring (match-beginning 1) (match-end 1)) | |
99 symbol-list)) | |
100 (forward-line 1)) | |
101 (setq symbol-list (nreverse symbol-list)) | |
102 ;; Delete the section of syms_of_... where we initialize the symbols. | |
103 (search-forward "\n /\*&&& init symbols here &&&*\/\n") | |
104 (let ((start (point))) | |
105 (while (looking-at "^ Q") | |
106 (forward-line 2)) | |
107 (kill-region start (point))) | |
108 ;; Write a new symbol initialization section. | |
109 (while symbol-list | |
110 (insert (format " %s = intern (\"" (car symbol-list))) | |
111 (let ((start (point))) | |
112 (insert (substring (car symbol-list) 1)) | |
113 (subst-char-in-region start (point) ?_ ?-)) | |
114 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list))) | |
115 (setq symbol-list (cdr symbol-list))))) | |
116 | |
117 */ | |
118 | |
119 /*&&& symbols declared here &&&*/ | |
120 Lisp_Object Qauto_raise; | |
121 Lisp_Object Qauto_lower; | |
122 Lisp_Object Qbackground_color; | |
123 Lisp_Object Qbar; | |
124 Lisp_Object Qborder_color; | |
125 Lisp_Object Qborder_width; | |
126 Lisp_Object Qbox; | |
127 Lisp_Object Qcursor_color; | |
128 Lisp_Object Qcursor_type; | |
129 Lisp_Object Qfont; | |
130 Lisp_Object Qforeground_color; | |
131 Lisp_Object Qgeometry; | |
132 Lisp_Object Qicon_left; | |
133 Lisp_Object Qicon_top; | |
134 Lisp_Object Qicon_type; | |
135 Lisp_Object Qicon_name; | |
136 Lisp_Object Qinternal_border_width; | |
137 Lisp_Object Qleft; | |
138 Lisp_Object Qmouse_color; | |
139 Lisp_Object Qnone; | |
140 Lisp_Object Qparent_id; | |
141 Lisp_Object Qscroll_bar_width; | |
142 Lisp_Object Qsuppress_icon; | |
143 Lisp_Object Qtop; | |
144 Lisp_Object Qundefined_color; | |
145 Lisp_Object Qvertical_scroll_bars; | |
146 Lisp_Object Qvisibility; | |
147 Lisp_Object Qwindow_id; | |
148 Lisp_Object Qx_frame_parameter; | |
149 Lisp_Object Qx_resource_name; | |
150 Lisp_Object Quser_position; | |
151 Lisp_Object Quser_size; | |
152 Lisp_Object Qdisplay; | |
153 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
154 /* State variables for emulating a three button mouse. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
155 #define LMOUSE 1 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
156 #define MMOUSE 2 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
157 #define RMOUSE 4 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
158 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
159 static int button_state = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
160 static Win32Msg saved_mouse_msg; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
161 static unsigned timer_id; /* non-zero when timer is active */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
162 |
13434 | 163 /* The below are defined in frame.c. */ |
164 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; | |
165 extern Lisp_Object Qunsplittable, Qmenu_bar_lines; | |
166 | |
167 extern Lisp_Object Vwindow_system_version; | |
168 | |
169 extern Lisp_Object last_mouse_scroll_bar; | |
170 extern int last_mouse_scroll_bar_pos; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
171 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
172 /* From win32term.c. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
173 extern Lisp_Object Vwin32_num_mouse_buttons; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
174 |
13434 | 175 Time last_mouse_movement_time; |
176 | |
177 | |
178 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame | |
179 and checking validity for Win32. */ | |
180 | |
181 FRAME_PTR | |
182 check_x_frame (frame) | |
183 Lisp_Object frame; | |
184 { | |
185 FRAME_PTR f; | |
186 | |
187 if (NILP (frame)) | |
188 f = selected_frame; | |
189 else | |
190 { | |
191 CHECK_LIVE_FRAME (frame, 0); | |
192 f = XFRAME (frame); | |
193 } | |
194 if (! FRAME_WIN32_P (f)) | |
195 error ("non-win32 frame used"); | |
196 return f; | |
197 } | |
198 | |
199 /* Let the user specify an display with a frame. | |
200 nil stands for the selected frame--or, if that is not a win32 frame, | |
201 the first display on the list. */ | |
202 | |
203 static struct win32_display_info * | |
204 check_x_display_info (frame) | |
205 Lisp_Object frame; | |
206 { | |
207 if (NILP (frame)) | |
208 { | |
209 if (FRAME_WIN32_P (selected_frame)) | |
210 return FRAME_WIN32_DISPLAY_INFO (selected_frame); | |
211 else | |
212 return &one_win32_display_info; | |
213 } | |
214 else if (STRINGP (frame)) | |
215 return x_display_info_for_name (frame); | |
216 else | |
217 { | |
218 FRAME_PTR f; | |
219 | |
220 CHECK_LIVE_FRAME (frame, 0); | |
221 f = XFRAME (frame); | |
222 if (! FRAME_WIN32_P (f)) | |
223 error ("non-win32 frame used"); | |
224 return FRAME_WIN32_DISPLAY_INFO (f); | |
225 } | |
226 } | |
227 | |
228 /* Return the Emacs frame-object corresponding to an win32 window. | |
229 It could be the frame's main window or an icon window. */ | |
230 | |
231 /* This function can be called during GC, so use GC_xxx type test macros. */ | |
232 | |
233 struct frame * | |
234 x_window_to_frame (dpyinfo, wdesc) | |
235 struct win32_display_info *dpyinfo; | |
236 HWND wdesc; | |
237 { | |
238 Lisp_Object tail, frame; | |
239 struct frame *f; | |
240 | |
241 for (tail = Vframe_list; GC_CONSP (tail); tail = XCONS (tail)->cdr) | |
242 { | |
243 frame = XCONS (tail)->car; | |
244 if (!GC_FRAMEP (frame)) | |
245 continue; | |
246 f = XFRAME (frame); | |
247 if (f->output_data.nothing == 1 | |
248 || FRAME_WIN32_DISPLAY_INFO (f) != dpyinfo) | |
249 continue; | |
250 if (FRAME_WIN32_WINDOW (f) == wdesc) | |
251 return f; | |
252 } | |
253 return 0; | |
254 } | |
255 | |
256 | |
257 | |
258 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap | |
259 id, which is just an int that this section returns. Bitmaps are | |
260 reference counted so they can be shared among frames. | |
261 | |
262 Bitmap indices are guaranteed to be > 0, so a negative number can | |
263 be used to indicate no bitmap. | |
264 | |
265 If you use x_create_bitmap_from_data, then you must keep track of | |
266 the bitmaps yourself. That is, creating a bitmap from the same | |
267 data more than once will not be caught. */ | |
268 | |
269 | |
270 /* Functions to access the contents of a bitmap, given an id. */ | |
271 | |
272 int | |
273 x_bitmap_height (f, id) | |
274 FRAME_PTR f; | |
275 int id; | |
276 { | |
277 return FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].height; | |
278 } | |
279 | |
280 int | |
281 x_bitmap_width (f, id) | |
282 FRAME_PTR f; | |
283 int id; | |
284 { | |
285 return FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].width; | |
286 } | |
287 | |
288 int | |
289 x_bitmap_pixmap (f, id) | |
290 FRAME_PTR f; | |
291 int id; | |
292 { | |
293 return (int) FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; | |
294 } | |
295 | |
296 | |
297 /* Allocate a new bitmap record. Returns index of new record. */ | |
298 | |
299 static int | |
300 x_allocate_bitmap_record (f) | |
301 FRAME_PTR f; | |
302 { | |
303 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f); | |
304 int i; | |
305 | |
306 if (dpyinfo->bitmaps == NULL) | |
307 { | |
308 dpyinfo->bitmaps_size = 10; | |
309 dpyinfo->bitmaps | |
310 = (struct win32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct win32_bitmap_record)); | |
311 dpyinfo->bitmaps_last = 1; | |
312 return 1; | |
313 } | |
314 | |
315 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size) | |
316 return ++dpyinfo->bitmaps_last; | |
317 | |
318 for (i = 0; i < dpyinfo->bitmaps_size; ++i) | |
319 if (dpyinfo->bitmaps[i].refcount == 0) | |
320 return i + 1; | |
321 | |
322 dpyinfo->bitmaps_size *= 2; | |
323 dpyinfo->bitmaps | |
324 = (struct win32_bitmap_record *) xrealloc (dpyinfo->bitmaps, | |
325 dpyinfo->bitmaps_size * sizeof (struct win32_bitmap_record)); | |
326 return ++dpyinfo->bitmaps_last; | |
327 } | |
328 | |
329 /* Add one reference to the reference count of the bitmap with id ID. */ | |
330 | |
331 void | |
332 x_reference_bitmap (f, id) | |
333 FRAME_PTR f; | |
334 int id; | |
335 { | |
336 ++FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; | |
337 } | |
338 | |
339 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ | |
340 | |
341 int | |
342 x_create_bitmap_from_data (f, bits, width, height) | |
343 struct frame *f; | |
344 char *bits; | |
345 unsigned int width, height; | |
346 { | |
347 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f); | |
348 Pixmap bitmap; | |
349 int id; | |
350 | |
351 bitmap = CreateBitmap (width, height, | |
352 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_planes, | |
353 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_cbits, | |
354 bits); | |
355 | |
356 if (! bitmap) | |
357 return -1; | |
358 | |
359 id = x_allocate_bitmap_record (f); | |
360 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
361 dpyinfo->bitmaps[id - 1].file = NULL; | |
362 dpyinfo->bitmaps[id - 1].hinst = NULL; | |
363 dpyinfo->bitmaps[id - 1].refcount = 1; | |
364 dpyinfo->bitmaps[id - 1].depth = 1; | |
365 dpyinfo->bitmaps[id - 1].height = height; | |
366 dpyinfo->bitmaps[id - 1].width = width; | |
367 | |
368 return id; | |
369 } | |
370 | |
371 /* Create bitmap from file FILE for frame F. */ | |
372 | |
373 int | |
374 x_create_bitmap_from_file (f, file) | |
375 struct frame *f; | |
376 Lisp_Object file; | |
377 { | |
378 return -1; | |
379 #if 0 | |
380 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f); | |
381 unsigned int width, height; | |
382 Pixmap bitmap; | |
383 int xhot, yhot, result, id; | |
384 Lisp_Object found; | |
385 int fd; | |
386 char *filename; | |
387 HINSTANCE hinst; | |
388 | |
389 /* Look for an existing bitmap with the same name. */ | |
390 for (id = 0; id < dpyinfo->bitmaps_last; ++id) | |
391 { | |
392 if (dpyinfo->bitmaps[id].refcount | |
393 && dpyinfo->bitmaps[id].file | |
394 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) | |
395 { | |
396 ++dpyinfo->bitmaps[id].refcount; | |
397 return id + 1; | |
398 } | |
399 } | |
400 | |
401 /* Search bitmap-file-path for the file, if appropriate. */ | |
402 fd = openp (Vx_bitmap_file_path, file, "", &found, 0); | |
403 if (fd < 0) | |
404 return -1; | |
405 close (fd); | |
406 | |
407 filename = (char *) XSTRING (found)->data; | |
408 | |
409 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE); | |
410 | |
411 if (hinst == NULL) | |
412 return -1; | |
413 | |
414 | |
415 result = XReadBitmapFile (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f), | |
416 filename, &width, &height, &bitmap, &xhot, &yhot); | |
417 if (result != BitmapSuccess) | |
418 return -1; | |
419 | |
420 id = x_allocate_bitmap_record (f); | |
421 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
422 dpyinfo->bitmaps[id - 1].refcount = 1; | |
423 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1); | |
424 dpyinfo->bitmaps[id - 1].depth = 1; | |
425 dpyinfo->bitmaps[id - 1].height = height; | |
426 dpyinfo->bitmaps[id - 1].width = width; | |
427 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); | |
428 | |
429 return id; | |
430 #endif | |
431 } | |
432 | |
433 /* Remove reference to bitmap with id number ID. */ | |
434 | |
435 int | |
436 x_destroy_bitmap (f, id) | |
437 FRAME_PTR f; | |
438 int id; | |
439 { | |
440 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f); | |
441 | |
442 if (id > 0) | |
443 { | |
444 --dpyinfo->bitmaps[id - 1].refcount; | |
445 if (dpyinfo->bitmaps[id - 1].refcount == 0) | |
446 { | |
447 BLOCK_INPUT; | |
448 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap); | |
449 if (dpyinfo->bitmaps[id - 1].file) | |
450 { | |
451 free (dpyinfo->bitmaps[id - 1].file); | |
452 dpyinfo->bitmaps[id - 1].file = NULL; | |
453 } | |
454 UNBLOCK_INPUT; | |
455 } | |
456 } | |
457 } | |
458 | |
459 /* Free all the bitmaps for the display specified by DPYINFO. */ | |
460 | |
461 static void | |
462 x_destroy_all_bitmaps (dpyinfo) | |
463 struct win32_display_info *dpyinfo; | |
464 { | |
465 int i; | |
466 for (i = 0; i < dpyinfo->bitmaps_last; i++) | |
467 if (dpyinfo->bitmaps[i].refcount > 0) | |
468 { | |
469 DeleteObject (dpyinfo->bitmaps[i].pixmap); | |
470 if (dpyinfo->bitmaps[i].file) | |
471 free (dpyinfo->bitmaps[i].file); | |
472 } | |
473 dpyinfo->bitmaps_last = 0; | |
474 } | |
475 | |
476 /* Connect the frame-parameter names for Win32 frames | |
477 to the ways of passing the parameter values to the window system. | |
478 | |
479 The name of a parameter, as a Lisp symbol, | |
480 has an `x-frame-parameter' property which is an integer in Lisp | |
481 but can be interpreted as an `enum x_frame_parm' in C. */ | |
482 | |
483 enum x_frame_parm | |
484 { | |
485 X_PARM_FOREGROUND_COLOR, | |
486 X_PARM_BACKGROUND_COLOR, | |
487 X_PARM_MOUSE_COLOR, | |
488 X_PARM_CURSOR_COLOR, | |
489 X_PARM_BORDER_COLOR, | |
490 X_PARM_ICON_TYPE, | |
491 X_PARM_FONT, | |
492 X_PARM_BORDER_WIDTH, | |
493 X_PARM_INTERNAL_BORDER_WIDTH, | |
494 X_PARM_NAME, | |
495 X_PARM_AUTORAISE, | |
496 X_PARM_AUTOLOWER, | |
497 X_PARM_VERT_SCROLL_BAR, | |
498 X_PARM_VISIBILITY, | |
499 X_PARM_MENU_BAR_LINES | |
500 }; | |
501 | |
502 | |
503 struct x_frame_parm_table | |
504 { | |
505 char *name; | |
506 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ ); | |
507 }; | |
508 | |
509 void x_set_foreground_color (); | |
510 void x_set_background_color (); | |
511 void x_set_mouse_color (); | |
512 void x_set_cursor_color (); | |
513 void x_set_border_color (); | |
514 void x_set_cursor_type (); | |
515 void x_set_icon_type (); | |
516 void x_set_icon_name (); | |
517 void x_set_font (); | |
518 void x_set_border_width (); | |
519 void x_set_internal_border_width (); | |
520 void x_explicitly_set_name (); | |
521 void x_set_autoraise (); | |
522 void x_set_autolower (); | |
523 void x_set_vertical_scroll_bars (); | |
524 void x_set_visibility (); | |
525 void x_set_menu_bar_lines (); | |
526 void x_set_scroll_bar_width (); | |
527 void x_set_unsplittable (); | |
528 | |
529 static struct x_frame_parm_table x_frame_parms[] = | |
530 { | |
531 "foreground-color", x_set_foreground_color, | |
532 "background-color", x_set_background_color, | |
533 "mouse-color", x_set_mouse_color, | |
534 "cursor-color", x_set_cursor_color, | |
535 "border-color", x_set_border_color, | |
536 "cursor-type", x_set_cursor_type, | |
537 "icon-type", x_set_icon_type, | |
538 "icon-name", x_set_icon_name, | |
539 "font", x_set_font, | |
540 "border-width", x_set_border_width, | |
541 "internal-border-width", x_set_internal_border_width, | |
542 "name", x_explicitly_set_name, | |
543 "auto-raise", x_set_autoraise, | |
544 "auto-lower", x_set_autolower, | |
545 "vertical-scroll-bars", x_set_vertical_scroll_bars, | |
546 "visibility", x_set_visibility, | |
547 "menu-bar-lines", x_set_menu_bar_lines, | |
548 "scroll-bar-width", x_set_scroll_bar_width, | |
549 "unsplittable", x_set_unsplittable, | |
550 }; | |
551 | |
552 /* Attach the `x-frame-parameter' properties to | |
553 the Lisp symbol names of parameters relevant to Win32. */ | |
554 | |
555 init_x_parm_symbols () | |
556 { | |
557 int i; | |
558 | |
559 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++) | |
560 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, | |
561 make_number (i)); | |
562 } | |
563 | |
564 /* Change the parameters of FRAME as specified by ALIST. | |
565 If a parameter is not specially recognized, do nothing; | |
566 otherwise call the `x_set_...' function for that parameter. */ | |
567 | |
568 void | |
569 x_set_frame_parameters (f, alist) | |
570 FRAME_PTR f; | |
571 Lisp_Object alist; | |
572 { | |
573 Lisp_Object tail; | |
574 | |
575 /* If both of these parameters are present, it's more efficient to | |
576 set them both at once. So we wait until we've looked at the | |
577 entire list before we set them. */ | |
578 Lisp_Object width, height; | |
579 | |
580 /* Same here. */ | |
581 Lisp_Object left, top; | |
582 | |
583 /* Same with these. */ | |
584 Lisp_Object icon_left, icon_top; | |
585 | |
586 /* Record in these vectors all the parms specified. */ | |
587 Lisp_Object *parms; | |
588 Lisp_Object *values; | |
589 int i; | |
590 int left_no_change = 0, top_no_change = 0; | |
591 int icon_left_no_change = 0, icon_top_no_change = 0; | |
592 | |
593 i = 0; | |
594 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
595 i++; | |
596 | |
597 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
598 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
599 | |
600 /* Extract parm names and values into those vectors. */ | |
601 | |
602 i = 0; | |
603 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
604 { | |
605 Lisp_Object elt, prop, val; | |
606 | |
607 elt = Fcar (tail); | |
608 parms[i] = Fcar (elt); | |
609 values[i] = Fcdr (elt); | |
610 i++; | |
611 } | |
612 | |
613 width = height = top = left = Qunbound; | |
614 icon_left = icon_top = Qunbound; | |
615 | |
616 /* Now process them in reverse of specified order. */ | |
617 for (i--; i >= 0; i--) | |
618 { | |
619 Lisp_Object prop, val; | |
620 | |
621 prop = parms[i]; | |
622 val = values[i]; | |
623 | |
624 if (EQ (prop, Qwidth)) | |
625 width = val; | |
626 else if (EQ (prop, Qheight)) | |
627 height = val; | |
628 else if (EQ (prop, Qtop)) | |
629 top = val; | |
630 else if (EQ (prop, Qleft)) | |
631 left = val; | |
632 else if (EQ (prop, Qicon_top)) | |
633 icon_top = val; | |
634 else if (EQ (prop, Qicon_left)) | |
635 icon_left = val; | |
636 else | |
637 { | |
638 register Lisp_Object param_index, old_value; | |
639 | |
640 param_index = Fget (prop, Qx_frame_parameter); | |
641 old_value = get_frame_param (f, prop); | |
642 store_frame_param (f, prop, val); | |
643 if (NATNUMP (param_index) | |
644 && (XFASTINT (param_index) | |
645 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) | |
14353 | 646 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); |
13434 | 647 } |
648 } | |
649 | |
650 /* Don't die if just one of these was set. */ | |
651 if (EQ (left, Qunbound)) | |
652 { | |
653 left_no_change = 1; | |
654 if (f->output_data.win32->left_pos < 0) | |
655 left = Fcons (Qplus, Fcons (make_number (f->output_data.win32->left_pos), Qnil)); | |
656 else | |
657 XSETINT (left, f->output_data.win32->left_pos); | |
658 } | |
659 if (EQ (top, Qunbound)) | |
660 { | |
661 top_no_change = 1; | |
662 if (f->output_data.win32->top_pos < 0) | |
663 top = Fcons (Qplus, Fcons (make_number (f->output_data.win32->top_pos), Qnil)); | |
664 else | |
665 XSETINT (top, f->output_data.win32->top_pos); | |
666 } | |
667 | |
668 /* If one of the icon positions was not set, preserve or default it. */ | |
669 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left)) | |
670 { | |
671 icon_left_no_change = 1; | |
672 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); | |
673 if (NILP (icon_left)) | |
674 XSETINT (icon_left, 0); | |
675 } | |
676 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top)) | |
677 { | |
678 icon_top_no_change = 1; | |
679 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); | |
680 if (NILP (icon_top)) | |
681 XSETINT (icon_top, 0); | |
682 } | |
683 | |
684 /* Don't die if just one of these was set. */ | |
685 if (EQ (width, Qunbound)) | |
686 XSETINT (width, FRAME_WIDTH (f)); | |
687 if (EQ (height, Qunbound)) | |
688 XSETINT (height, FRAME_HEIGHT (f)); | |
689 | |
690 /* Don't set these parameters unless they've been explicitly | |
691 specified. The window might be mapped or resized while we're in | |
692 this function, and we don't want to override that unless the lisp | |
693 code has asked for it. | |
694 | |
695 Don't set these parameters unless they actually differ from the | |
696 window's current parameters; the window may not actually exist | |
697 yet. */ | |
698 { | |
699 Lisp_Object frame; | |
700 | |
701 check_frame_size (f, &height, &width); | |
702 | |
703 XSETFRAME (frame, f); | |
704 | |
705 if ((NUMBERP (width) && XINT (width) != FRAME_WIDTH (f)) | |
706 || (NUMBERP (height) && XINT (height) != FRAME_HEIGHT (f))) | |
707 Fset_frame_size (frame, width, height); | |
708 | |
709 if ((!NILP (left) || !NILP (top)) | |
710 && ! (left_no_change && top_no_change) | |
711 && ! (NUMBERP (left) && XINT (left) == f->output_data.win32->left_pos | |
712 && NUMBERP (top) && XINT (top) == f->output_data.win32->top_pos)) | |
713 { | |
714 int leftpos = 0; | |
715 int toppos = 0; | |
716 | |
717 /* Record the signs. */ | |
718 f->output_data.win32->size_hint_flags &= ~ (XNegative | YNegative); | |
719 if (EQ (left, Qminus)) | |
720 f->output_data.win32->size_hint_flags |= XNegative; | |
721 else if (INTEGERP (left)) | |
722 { | |
723 leftpos = XINT (left); | |
724 if (leftpos < 0) | |
725 f->output_data.win32->size_hint_flags |= XNegative; | |
726 } | |
727 else if (CONSP (left) && EQ (XCONS (left)->car, Qminus) | |
728 && CONSP (XCONS (left)->cdr) | |
729 && INTEGERP (XCONS (XCONS (left)->cdr)->car)) | |
730 { | |
731 leftpos = - XINT (XCONS (XCONS (left)->cdr)->car); | |
732 f->output_data.win32->size_hint_flags |= XNegative; | |
733 } | |
734 else if (CONSP (left) && EQ (XCONS (left)->car, Qplus) | |
735 && CONSP (XCONS (left)->cdr) | |
736 && INTEGERP (XCONS (XCONS (left)->cdr)->car)) | |
737 { | |
738 leftpos = XINT (XCONS (XCONS (left)->cdr)->car); | |
739 } | |
740 | |
741 if (EQ (top, Qminus)) | |
742 f->output_data.win32->size_hint_flags |= YNegative; | |
743 else if (INTEGERP (top)) | |
744 { | |
745 toppos = XINT (top); | |
746 if (toppos < 0) | |
747 f->output_data.win32->size_hint_flags |= YNegative; | |
748 } | |
749 else if (CONSP (top) && EQ (XCONS (top)->car, Qminus) | |
750 && CONSP (XCONS (top)->cdr) | |
751 && INTEGERP (XCONS (XCONS (top)->cdr)->car)) | |
752 { | |
753 toppos = - XINT (XCONS (XCONS (top)->cdr)->car); | |
754 f->output_data.win32->size_hint_flags |= YNegative; | |
755 } | |
756 else if (CONSP (top) && EQ (XCONS (top)->car, Qplus) | |
757 && CONSP (XCONS (top)->cdr) | |
758 && INTEGERP (XCONS (XCONS (top)->cdr)->car)) | |
759 { | |
760 toppos = XINT (XCONS (XCONS (top)->cdr)->car); | |
761 } | |
762 | |
763 | |
764 /* Store the numeric value of the position. */ | |
765 f->output_data.win32->top_pos = toppos; | |
766 f->output_data.win32->left_pos = leftpos; | |
767 | |
768 f->output_data.win32->win_gravity = NorthWestGravity; | |
769 | |
770 /* Actually set that position, and convert to absolute. */ | |
771 x_set_offset (f, leftpos, toppos, -1); | |
772 } | |
773 | |
774 if ((!NILP (icon_left) || !NILP (icon_top)) | |
775 && ! (icon_left_no_change && icon_top_no_change)) | |
776 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); | |
777 } | |
778 } | |
779 | |
780 /* Store the screen positions of frame F into XPTR and YPTR. | |
781 These are the positions of the containing window manager window, | |
782 not Emacs's own window. */ | |
783 | |
784 void | |
785 x_real_positions (f, xptr, yptr) | |
786 FRAME_PTR f; | |
787 int *xptr, *yptr; | |
788 { | |
789 POINT pt; | |
14353 | 790 |
791 { | |
792 RECT rect; | |
13434 | 793 |
14353 | 794 GetClientRect(FRAME_WIN32_WINDOW(f), &rect); |
795 AdjustWindowRect(&rect, f->output_data.win32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f)); | |
13434 | 796 |
14353 | 797 pt.x = rect.left; |
798 pt.y = rect.top; | |
799 } | |
800 | |
801 ClientToScreen (FRAME_WIN32_WINDOW(f), &pt); | |
13434 | 802 |
803 *xptr = pt.x; | |
804 *yptr = pt.y; | |
805 } | |
806 | |
807 /* Insert a description of internally-recorded parameters of frame X | |
808 into the parameter alist *ALISTPTR that is to be given to the user. | |
809 Only parameters that are specific to Win32 | |
810 and whose values are not correctly recorded in the frame's | |
811 param_alist need to be considered here. */ | |
812 | |
813 x_report_frame_params (f, alistptr) | |
814 struct frame *f; | |
815 Lisp_Object *alistptr; | |
816 { | |
817 char buf[16]; | |
818 Lisp_Object tem; | |
819 | |
820 /* Represent negative positions (off the top or left screen edge) | |
821 in a way that Fmodify_frame_parameters will understand correctly. */ | |
822 XSETINT (tem, f->output_data.win32->left_pos); | |
823 if (f->output_data.win32->left_pos >= 0) | |
824 store_in_alist (alistptr, Qleft, tem); | |
825 else | |
826 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil))); | |
827 | |
828 XSETINT (tem, f->output_data.win32->top_pos); | |
829 if (f->output_data.win32->top_pos >= 0) | |
830 store_in_alist (alistptr, Qtop, tem); | |
831 else | |
832 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil))); | |
833 | |
834 store_in_alist (alistptr, Qborder_width, | |
835 make_number (f->output_data.win32->border_width)); | |
836 store_in_alist (alistptr, Qinternal_border_width, | |
837 make_number (f->output_data.win32->internal_border_width)); | |
838 sprintf (buf, "%ld", (long) FRAME_WIN32_WINDOW (f)); | |
839 store_in_alist (alistptr, Qwindow_id, | |
840 build_string (buf)); | |
841 store_in_alist (alistptr, Qicon_name, f->icon_name); | |
842 FRAME_SAMPLE_VISIBILITY (f); | |
843 store_in_alist (alistptr, Qvisibility, | |
844 (FRAME_VISIBLE_P (f) ? Qt | |
845 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); | |
846 store_in_alist (alistptr, Qdisplay, | |
847 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->car); | |
848 } | |
849 | |
850 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
851 DEFUN ("win32-define-rgb-color", Fwin32_define_rgb_color, Swin32_define_rgb_color, 4, 4, 0, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
852 "Convert RGB numbers to a windows color reference and associate with NAME (a string).\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
853 This adds or updates a named color to win32-color-map, making it available for use.\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
854 The original entry's RGB ref is returned, or nil if the entry is new.") |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
855 (red, green, blue, name) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
856 Lisp_Object red, green, blue, name; |
13434 | 857 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
858 Lisp_Object rgb; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
859 Lisp_Object oldrgb = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
860 Lisp_Object entry; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
861 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
862 CHECK_NUMBER (red, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
863 CHECK_NUMBER (green, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
864 CHECK_NUMBER (blue, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
865 CHECK_STRING (name, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
866 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
867 XSET (rgb, Lisp_Int, RGB(XUINT (red), XUINT (green), XUINT (blue))); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
868 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
869 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
870 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
871 /* replace existing entry in win32-color-map or add new entry. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
872 entry = Fassoc (name, Vwin32_color_map); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
873 if (NILP (entry)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
874 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
875 entry = Fcons (name, rgb); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
876 Vwin32_color_map = Fcons (entry, Vwin32_color_map); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
877 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
878 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
879 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
880 oldrgb = Fcdr (entry); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
881 Fsetcdr (entry, rgb); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
882 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
883 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
884 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
885 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
886 return (oldrgb); |
13434 | 887 } |
888 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
889 DEFUN ("win32-load-color-file", Fwin32_load_color_file, Swin32_load_color_file, 1, 1, 0, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
890 "Create an alist of color entries from an external file (ie. rgb.txt).\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
891 Assign this value to win32-color-map to replace the existing color map.\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
892 \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
893 The file should define one named RGB color per line like so:\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
894 R G B name\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
895 where R,G,B are numbers between 0 and 255 and name is an arbitrary string.") |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
896 (filename) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
897 Lisp_Object filename; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
898 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
899 FILE *fp; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
900 Lisp_Object cmap = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
901 Lisp_Object abspath; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
902 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
903 CHECK_STRING (filename, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
904 abspath = Fexpand_file_name (filename, Qnil); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
905 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
906 fp = fopen (XSTRING (filename)->data, "rt"); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
907 if (fp) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
908 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
909 char buf[512]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
910 int red, green, blue; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
911 int num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
912 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
913 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
914 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
915 while (fgets (buf, sizeof (buf), fp) != NULL) { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
916 if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
917 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
918 char *name = buf + num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
919 num = strlen (name) - 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
920 if (name[num] == '\n') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
921 name[num] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
922 cmap = Fcons (Fcons (build_string (name), |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
923 make_number (RGB (red, green, blue))), |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
924 cmap); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
925 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
926 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
927 fclose (fp); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
928 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
929 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
930 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
931 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
932 return cmap; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
933 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
934 |
13434 | 935 /* The default colors for the win32 color map */ |
936 typedef struct colormap_t | |
937 { | |
938 char *name; | |
939 COLORREF colorref; | |
940 } colormap_t; | |
941 | |
942 colormap_t win32_color_map[] = | |
943 { | |
14983
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
944 {"snow" , PALETTERGB (255,250,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
945 {"ghost white" , PALETTERGB (248,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
946 {"GhostWhite" , PALETTERGB (248,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
947 {"white smoke" , PALETTERGB (245,245,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
948 {"WhiteSmoke" , PALETTERGB (245,245,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
949 {"gainsboro" , PALETTERGB (220,220,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
950 {"floral white" , PALETTERGB (255,250,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
951 {"FloralWhite" , PALETTERGB (255,250,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
952 {"old lace" , PALETTERGB (253,245,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
953 {"OldLace" , PALETTERGB (253,245,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
954 {"linen" , PALETTERGB (250,240,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
955 {"antique white" , PALETTERGB (250,235,215)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
956 {"AntiqueWhite" , PALETTERGB (250,235,215)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
957 {"papaya whip" , PALETTERGB (255,239,213)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
958 {"PapayaWhip" , PALETTERGB (255,239,213)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
959 {"blanched almond" , PALETTERGB (255,235,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
960 {"BlanchedAlmond" , PALETTERGB (255,235,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
961 {"bisque" , PALETTERGB (255,228,196)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
962 {"peach puff" , PALETTERGB (255,218,185)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
963 {"PeachPuff" , PALETTERGB (255,218,185)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
964 {"navajo white" , PALETTERGB (255,222,173)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
965 {"NavajoWhite" , PALETTERGB (255,222,173)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
966 {"moccasin" , PALETTERGB (255,228,181)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
967 {"cornsilk" , PALETTERGB (255,248,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
968 {"ivory" , PALETTERGB (255,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
969 {"lemon chiffon" , PALETTERGB (255,250,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
970 {"LemonChiffon" , PALETTERGB (255,250,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
971 {"seashell" , PALETTERGB (255,245,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
972 {"honeydew" , PALETTERGB (240,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
973 {"mint cream" , PALETTERGB (245,255,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
974 {"MintCream" , PALETTERGB (245,255,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
975 {"azure" , PALETTERGB (240,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
976 {"alice blue" , PALETTERGB (240,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
977 {"AliceBlue" , PALETTERGB (240,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
978 {"lavender" , PALETTERGB (230,230,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
979 {"lavender blush" , PALETTERGB (255,240,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
980 {"LavenderBlush" , PALETTERGB (255,240,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
981 {"misty rose" , PALETTERGB (255,228,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
982 {"MistyRose" , PALETTERGB (255,228,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
983 {"white" , PALETTERGB (255,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
984 {"black" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
985 {"dark slate gray" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
986 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
987 {"dark slate grey" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
988 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
989 {"dim gray" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
990 {"DimGray" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
991 {"dim grey" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
992 {"DimGrey" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
993 {"slate gray" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
994 {"SlateGray" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
995 {"slate grey" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
996 {"SlateGrey" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
997 {"light slate gray" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
998 {"LightSlateGray" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
999 {"light slate grey" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1000 {"LightSlateGrey" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1001 {"gray" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1002 {"grey" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1003 {"light grey" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1004 {"LightGrey" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1005 {"light gray" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1006 {"LightGray" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1007 {"midnight blue" , PALETTERGB ( 25, 25,112)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1008 {"MidnightBlue" , PALETTERGB ( 25, 25,112)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1009 {"navy" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1010 {"navy blue" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1011 {"NavyBlue" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1012 {"cornflower blue" , PALETTERGB (100,149,237)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1013 {"CornflowerBlue" , PALETTERGB (100,149,237)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1014 {"dark slate blue" , PALETTERGB ( 72, 61,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1015 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1016 {"slate blue" , PALETTERGB (106, 90,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1017 {"SlateBlue" , PALETTERGB (106, 90,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1018 {"medium slate blue" , PALETTERGB (123,104,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1019 {"MediumSlateBlue" , PALETTERGB (123,104,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1020 {"light slate blue" , PALETTERGB (132,112,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1021 {"LightSlateBlue" , PALETTERGB (132,112,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1022 {"medium blue" , PALETTERGB ( 0, 0,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1023 {"MediumBlue" , PALETTERGB ( 0, 0,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1024 {"royal blue" , PALETTERGB ( 65,105,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1025 {"RoyalBlue" , PALETTERGB ( 65,105,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1026 {"blue" , PALETTERGB ( 0, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1027 {"dodger blue" , PALETTERGB ( 30,144,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1028 {"DodgerBlue" , PALETTERGB ( 30,144,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1029 {"deep sky blue" , PALETTERGB ( 0,191,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1030 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1031 {"sky blue" , PALETTERGB (135,206,235)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1032 {"SkyBlue" , PALETTERGB (135,206,235)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1033 {"light sky blue" , PALETTERGB (135,206,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1034 {"LightSkyBlue" , PALETTERGB (135,206,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1035 {"steel blue" , PALETTERGB ( 70,130,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1036 {"SteelBlue" , PALETTERGB ( 70,130,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1037 {"light steel blue" , PALETTERGB (176,196,222)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1038 {"LightSteelBlue" , PALETTERGB (176,196,222)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1039 {"light blue" , PALETTERGB (173,216,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1040 {"LightBlue" , PALETTERGB (173,216,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1041 {"powder blue" , PALETTERGB (176,224,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1042 {"PowderBlue" , PALETTERGB (176,224,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1043 {"pale turquoise" , PALETTERGB (175,238,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1044 {"PaleTurquoise" , PALETTERGB (175,238,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1045 {"dark turquoise" , PALETTERGB ( 0,206,209)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1046 {"DarkTurquoise" , PALETTERGB ( 0,206,209)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1047 {"medium turquoise" , PALETTERGB ( 72,209,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1048 {"MediumTurquoise" , PALETTERGB ( 72,209,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1049 {"turquoise" , PALETTERGB ( 64,224,208)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1050 {"cyan" , PALETTERGB ( 0,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1051 {"light cyan" , PALETTERGB (224,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1052 {"LightCyan" , PALETTERGB (224,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1053 {"cadet blue" , PALETTERGB ( 95,158,160)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1054 {"CadetBlue" , PALETTERGB ( 95,158,160)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1055 {"medium aquamarine" , PALETTERGB (102,205,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1056 {"MediumAquamarine" , PALETTERGB (102,205,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1057 {"aquamarine" , PALETTERGB (127,255,212)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1058 {"dark green" , PALETTERGB ( 0,100, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1059 {"DarkGreen" , PALETTERGB ( 0,100, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1060 {"dark olive green" , PALETTERGB ( 85,107, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1061 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1062 {"dark sea green" , PALETTERGB (143,188,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1063 {"DarkSeaGreen" , PALETTERGB (143,188,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1064 {"sea green" , PALETTERGB ( 46,139, 87)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1065 {"SeaGreen" , PALETTERGB ( 46,139, 87)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1066 {"medium sea green" , PALETTERGB ( 60,179,113)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1067 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1068 {"light sea green" , PALETTERGB ( 32,178,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1069 {"LightSeaGreen" , PALETTERGB ( 32,178,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1070 {"pale green" , PALETTERGB (152,251,152)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1071 {"PaleGreen" , PALETTERGB (152,251,152)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1072 {"spring green" , PALETTERGB ( 0,255,127)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1073 {"SpringGreen" , PALETTERGB ( 0,255,127)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1074 {"lawn green" , PALETTERGB (124,252, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1075 {"LawnGreen" , PALETTERGB (124,252, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1076 {"green" , PALETTERGB ( 0,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1077 {"chartreuse" , PALETTERGB (127,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1078 {"medium spring green" , PALETTERGB ( 0,250,154)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1079 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1080 {"green yellow" , PALETTERGB (173,255, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1081 {"GreenYellow" , PALETTERGB (173,255, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1082 {"lime green" , PALETTERGB ( 50,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1083 {"LimeGreen" , PALETTERGB ( 50,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1084 {"yellow green" , PALETTERGB (154,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1085 {"YellowGreen" , PALETTERGB (154,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1086 {"forest green" , PALETTERGB ( 34,139, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1087 {"ForestGreen" , PALETTERGB ( 34,139, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1088 {"olive drab" , PALETTERGB (107,142, 35)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1089 {"OliveDrab" , PALETTERGB (107,142, 35)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1090 {"dark khaki" , PALETTERGB (189,183,107)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1091 {"DarkKhaki" , PALETTERGB (189,183,107)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1092 {"khaki" , PALETTERGB (240,230,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1093 {"pale goldenrod" , PALETTERGB (238,232,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1094 {"PaleGoldenrod" , PALETTERGB (238,232,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1095 {"light goldenrod yellow" , PALETTERGB (250,250,210)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1096 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1097 {"light yellow" , PALETTERGB (255,255,224)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1098 {"LightYellow" , PALETTERGB (255,255,224)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1099 {"yellow" , PALETTERGB (255,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1100 {"gold" , PALETTERGB (255,215, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1101 {"light goldenrod" , PALETTERGB (238,221,130)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1102 {"LightGoldenrod" , PALETTERGB (238,221,130)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1103 {"goldenrod" , PALETTERGB (218,165, 32)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1104 {"dark goldenrod" , PALETTERGB (184,134, 11)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1105 {"DarkGoldenrod" , PALETTERGB (184,134, 11)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1106 {"rosy brown" , PALETTERGB (188,143,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1107 {"RosyBrown" , PALETTERGB (188,143,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1108 {"indian red" , PALETTERGB (205, 92, 92)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1109 {"IndianRed" , PALETTERGB (205, 92, 92)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1110 {"saddle brown" , PALETTERGB (139, 69, 19)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1111 {"SaddleBrown" , PALETTERGB (139, 69, 19)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1112 {"sienna" , PALETTERGB (160, 82, 45)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1113 {"peru" , PALETTERGB (205,133, 63)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1114 {"burlywood" , PALETTERGB (222,184,135)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1115 {"beige" , PALETTERGB (245,245,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1116 {"wheat" , PALETTERGB (245,222,179)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1117 {"sandy brown" , PALETTERGB (244,164, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1118 {"SandyBrown" , PALETTERGB (244,164, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1119 {"tan" , PALETTERGB (210,180,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1120 {"chocolate" , PALETTERGB (210,105, 30)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1121 {"firebrick" , PALETTERGB (178,34, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1122 {"brown" , PALETTERGB (165,42, 42)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1123 {"dark salmon" , PALETTERGB (233,150,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1124 {"DarkSalmon" , PALETTERGB (233,150,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1125 {"salmon" , PALETTERGB (250,128,114)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1126 {"light salmon" , PALETTERGB (255,160,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1127 {"LightSalmon" , PALETTERGB (255,160,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1128 {"orange" , PALETTERGB (255,165, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1129 {"dark orange" , PALETTERGB (255,140, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1130 {"DarkOrange" , PALETTERGB (255,140, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1131 {"coral" , PALETTERGB (255,127, 80)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1132 {"light coral" , PALETTERGB (240,128,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1133 {"LightCoral" , PALETTERGB (240,128,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1134 {"tomato" , PALETTERGB (255, 99, 71)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1135 {"orange red" , PALETTERGB (255, 69, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1136 {"OrangeRed" , PALETTERGB (255, 69, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1137 {"red" , PALETTERGB (255, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1138 {"hot pink" , PALETTERGB (255,105,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1139 {"HotPink" , PALETTERGB (255,105,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1140 {"deep pink" , PALETTERGB (255, 20,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1141 {"DeepPink" , PALETTERGB (255, 20,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1142 {"pink" , PALETTERGB (255,192,203)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1143 {"light pink" , PALETTERGB (255,182,193)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1144 {"LightPink" , PALETTERGB (255,182,193)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1145 {"pale violet red" , PALETTERGB (219,112,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1146 {"PaleVioletRed" , PALETTERGB (219,112,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1147 {"maroon" , PALETTERGB (176, 48, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1148 {"medium violet red" , PALETTERGB (199, 21,133)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1149 {"MediumVioletRed" , PALETTERGB (199, 21,133)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1150 {"violet red" , PALETTERGB (208, 32,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1151 {"VioletRed" , PALETTERGB (208, 32,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1152 {"magenta" , PALETTERGB (255, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1153 {"violet" , PALETTERGB (238,130,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1154 {"plum" , PALETTERGB (221,160,221)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1155 {"orchid" , PALETTERGB (218,112,214)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1156 {"medium orchid" , PALETTERGB (186, 85,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1157 {"MediumOrchid" , PALETTERGB (186, 85,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1158 {"dark orchid" , PALETTERGB (153, 50,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1159 {"DarkOrchid" , PALETTERGB (153, 50,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1160 {"dark violet" , PALETTERGB (148, 0,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1161 {"DarkViolet" , PALETTERGB (148, 0,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1162 {"blue violet" , PALETTERGB (138, 43,226)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1163 {"BlueViolet" , PALETTERGB (138, 43,226)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1164 {"purple" , PALETTERGB (160, 32,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1165 {"medium purple" , PALETTERGB (147,112,219)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1166 {"MediumPurple" , PALETTERGB (147,112,219)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1167 {"thistle" , PALETTERGB (216,191,216)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1168 {"gray0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1169 {"grey0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1170 {"dark grey" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1171 {"DarkGrey" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1172 {"dark gray" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1173 {"DarkGray" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1174 {"dark blue" , PALETTERGB ( 0, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1175 {"DarkBlue" , PALETTERGB ( 0, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1176 {"dark cyan" , PALETTERGB ( 0,139,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1177 {"DarkCyan" , PALETTERGB ( 0,139,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1178 {"dark magenta" , PALETTERGB (139, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1179 {"DarkMagenta" , PALETTERGB (139, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1180 {"dark red" , PALETTERGB (139, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1181 {"DarkRed" , PALETTERGB (139, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1182 {"light green" , PALETTERGB (144,238,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1183 {"LightGreen" , PALETTERGB (144,238,144)}, |
13434 | 1184 }; |
1185 | |
1186 DEFUN ("win32-default-color-map", Fwin32_default_color_map, Swin32_default_color_map, | |
1187 0, 0, 0, "Return the default color map.") | |
1188 () | |
1189 { | |
1190 int i; | |
1191 colormap_t *pc = win32_color_map; | |
1192 Lisp_Object cmap; | |
1193 | |
1194 BLOCK_INPUT; | |
1195 | |
1196 cmap = Qnil; | |
1197 | |
1198 for (i = 0; i < sizeof (win32_color_map) / sizeof (win32_color_map[0]); | |
1199 pc++, i++) | |
1200 cmap = Fcons (Fcons (build_string (pc->name), | |
1201 make_number (pc->colorref)), | |
1202 cmap); | |
1203 | |
1204 UNBLOCK_INPUT; | |
1205 | |
1206 return (cmap); | |
1207 } | |
1208 | |
1209 Lisp_Object | |
1210 win32_to_x_color (rgb) | |
1211 Lisp_Object rgb; | |
1212 { | |
1213 Lisp_Object color; | |
1214 | |
1215 CHECK_NUMBER (rgb, 0); | |
1216 | |
1217 BLOCK_INPUT; | |
1218 | |
1219 color = Frassq (rgb, Vwin32_color_map); | |
1220 | |
1221 UNBLOCK_INPUT; | |
1222 | |
1223 if (!NILP (color)) | |
1224 return (Fcar (color)); | |
1225 else | |
1226 return Qnil; | |
1227 } | |
1228 | |
1229 COLORREF | |
1230 x_to_win32_color (colorname) | |
1231 char * colorname; | |
1232 { | |
1233 register Lisp_Object tail, ret = Qnil; | |
1234 | |
1235 BLOCK_INPUT; | |
1236 | |
1237 for (tail = Vwin32_color_map; !NILP (tail); tail = Fcdr (tail)) | |
1238 { | |
1239 register Lisp_Object elt, tem; | |
1240 | |
1241 elt = Fcar (tail); | |
1242 if (!CONSP (elt)) continue; | |
1243 | |
1244 tem = Fcar (elt); | |
1245 | |
1246 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0) | |
1247 { | |
1248 ret = XUINT(Fcdr (elt)); | |
1249 break; | |
1250 } | |
1251 | |
1252 QUIT; | |
1253 } | |
1254 | |
1255 UNBLOCK_INPUT; | |
1256 | |
1257 return ret; | |
1258 } | |
1259 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1260 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1261 void |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1262 win32_regenerate_palette (FRAME_PTR f) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1263 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1264 struct win32_palette_entry * list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1265 LOGPALETTE * log_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1266 HPALETTE new_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1267 int i; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1268 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1269 /* don't bother trying to create palette if not supported */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1270 if (! FRAME_WIN32_DISPLAY_INFO (f)->has_palette) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1271 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1272 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1273 log_palette = (LOGPALETTE *) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1274 alloca (sizeof (LOGPALETTE) + |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1275 FRAME_WIN32_DISPLAY_INFO (f)->num_colors * sizeof (PALETTEENTRY)); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1276 log_palette->palVersion = 0x300; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1277 log_palette->palNumEntries = FRAME_WIN32_DISPLAY_INFO (f)->num_colors; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1278 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1279 list = FRAME_WIN32_DISPLAY_INFO (f)->color_list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1280 for (i = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1281 i < FRAME_WIN32_DISPLAY_INFO (f)->num_colors; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1282 i++, list = list->next) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1283 log_palette->palPalEntry[i] = list->entry; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1284 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1285 new_palette = CreatePalette (log_palette); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1286 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1287 enter_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1288 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1289 if (FRAME_WIN32_DISPLAY_INFO (f)->palette) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1290 DeleteObject (FRAME_WIN32_DISPLAY_INFO (f)->palette); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1291 FRAME_WIN32_DISPLAY_INFO (f)->palette = new_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1292 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1293 /* Realize display palette and garbage all frames. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1294 release_frame_dc (f, get_frame_dc (f)); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1295 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1296 leave_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1297 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1298 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1299 #define WIN32_COLOR(pe) RGB (pe.peRed, pe.peGreen, pe.peBlue) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1300 #define SET_WIN32_COLOR(pe, color) \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1301 do \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1302 { \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1303 pe.peRed = GetRValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1304 pe.peGreen = GetGValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1305 pe.peBlue = GetBValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1306 pe.peFlags = 0; \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1307 } while (0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1308 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1309 #if 0 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1310 /* Keep these around in case we ever want to track color usage. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1311 void |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1312 win32_map_color (FRAME_PTR f, COLORREF color) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1313 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1314 struct win32_palette_entry * list = FRAME_WIN32_DISPLAY_INFO (f)->color_list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1315 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1316 if (NILP (Vwin32_enable_palette)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1317 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1318 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1319 /* check if color is already mapped */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1320 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1321 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1322 if (WIN32_COLOR (list->entry) == color) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1323 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1324 ++list->refcount; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1325 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1326 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1327 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1328 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1329 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1330 /* not already mapped, so add to list and recreate Windows palette */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1331 list = (struct win32_palette_entry *) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1332 xmalloc (sizeof (struct win32_palette_entry)); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1333 SET_WIN32_COLOR (list->entry, color); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1334 list->refcount = 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1335 list->next = FRAME_WIN32_DISPLAY_INFO (f)->color_list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1336 FRAME_WIN32_DISPLAY_INFO (f)->color_list = list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1337 FRAME_WIN32_DISPLAY_INFO (f)->num_colors++; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1338 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1339 /* set flag that palette must be regenerated */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1340 FRAME_WIN32_DISPLAY_INFO (f)->regen_palette = TRUE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1341 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1342 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1343 void |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1344 win32_unmap_color (FRAME_PTR f, COLORREF color) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1345 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1346 struct win32_palette_entry * list = FRAME_WIN32_DISPLAY_INFO (f)->color_list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1347 struct win32_palette_entry **prev = &FRAME_WIN32_DISPLAY_INFO (f)->color_list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1348 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1349 if (NILP (Vwin32_enable_palette)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1350 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1351 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1352 /* check if color is already mapped */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1353 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1354 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1355 if (WIN32_COLOR (list->entry) == color) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1356 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1357 if (--list->refcount == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1358 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1359 *prev = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1360 xfree (list); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1361 FRAME_WIN32_DISPLAY_INFO (f)->num_colors--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1362 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1363 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1364 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1365 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1366 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1367 prev = &list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1368 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1369 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1370 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1371 /* set flag that palette must be regenerated */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1372 FRAME_WIN32_DISPLAY_INFO (f)->regen_palette = TRUE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1373 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1374 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1375 |
13434 | 1376 /* Decide if color named COLOR is valid for the display associated with |
1377 the selected frame; if so, return the rgb values in COLOR_DEF. | |
1378 If ALLOC is nonzero, allocate a new colormap cell. */ | |
1379 | |
1380 int | |
1381 defined_color (f, color, color_def, alloc) | |
1382 FRAME_PTR f; | |
1383 char *color; | |
1384 COLORREF *color_def; | |
1385 int alloc; | |
1386 { | |
1387 register Lisp_Object tem; | |
14353 | 1388 |
13434 | 1389 tem = x_to_win32_color (color); |
14353 | 1390 |
13434 | 1391 if (!NILP (tem)) |
1392 { | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1393 if (!NILP (Vwin32_enable_palette)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1394 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1395 struct win32_palette_entry * entry = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1396 FRAME_WIN32_DISPLAY_INFO (f)->color_list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1397 struct win32_palette_entry ** prev = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1398 &FRAME_WIN32_DISPLAY_INFO (f)->color_list; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1399 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1400 /* check if color is already mapped */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1401 while (entry) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1402 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1403 if (WIN32_COLOR (entry->entry) == XUINT (tem)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1404 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1405 prev = &entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1406 entry = entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1407 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1408 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1409 if (entry == NULL && alloc) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1410 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1411 /* not already mapped, so add to list */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1412 entry = (struct win32_palette_entry *) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1413 xmalloc (sizeof (struct win32_palette_entry)); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1414 SET_WIN32_COLOR (entry->entry, XUINT (tem)); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1415 entry->next = NULL; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1416 *prev = entry; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1417 FRAME_WIN32_DISPLAY_INFO (f)->num_colors++; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1418 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1419 /* set flag that palette must be regenerated */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1420 FRAME_WIN32_DISPLAY_INFO (f)->regen_palette = TRUE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1421 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1422 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1423 /* Ensure COLORREF value is snapped to nearest color in (default) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1424 palette by simulating the PALETTERGB macro. This works whether |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1425 or not the display device has a palette. */ |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
1426 *color_def = XUINT (tem) | 0x2000000; |
13434 | 1427 return 1; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1428 } |
13434 | 1429 else |
14353 | 1430 { |
1431 return 0; | |
1432 } | |
13434 | 1433 } |
1434 | |
1435 /* Given a string ARG naming a color, compute a pixel value from it | |
1436 suitable for screen F. | |
1437 If F is not a color screen, return DEF (default) regardless of what | |
1438 ARG says. */ | |
1439 | |
1440 int | |
1441 x_decode_color (f, arg, def) | |
1442 FRAME_PTR f; | |
1443 Lisp_Object arg; | |
1444 int def; | |
1445 { | |
1446 COLORREF cdef; | |
1447 | |
1448 CHECK_STRING (arg, 0); | |
1449 | |
1450 if (strcmp (XSTRING (arg)->data, "black") == 0) | |
1451 return BLACK_PIX_DEFAULT (f); | |
1452 else if (strcmp (XSTRING (arg)->data, "white") == 0) | |
1453 return WHITE_PIX_DEFAULT (f); | |
1454 | |
1455 if ((FRAME_WIN32_DISPLAY_INFO (f)->n_planes * FRAME_WIN32_DISPLAY_INFO (f)->n_cbits) == 1) | |
1456 return def; | |
1457 | |
1458 /* defined_color is responsible for coping with failures | |
1459 by looking for a near-miss. */ | |
1460 if (defined_color (f, XSTRING (arg)->data, &cdef, 1)) | |
1461 return cdef; | |
1462 | |
1463 /* defined_color failed; return an ultimate default. */ | |
1464 return def; | |
1465 } | |
1466 | |
1467 /* Functions called only from `x_set_frame_param' | |
1468 to set individual parameters. | |
1469 | |
1470 If FRAME_WIN32_WINDOW (f) is 0, | |
1471 the frame is being created and its window does not exist yet. | |
1472 In that case, just record the parameter's new value | |
1473 in the standard place; do not attempt to change the window. */ | |
1474 | |
1475 void | |
1476 x_set_foreground_color (f, arg, oldval) | |
1477 struct frame *f; | |
1478 Lisp_Object arg, oldval; | |
1479 { | |
1480 f->output_data.win32->foreground_pixel | |
1481 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1482 |
13434 | 1483 if (FRAME_WIN32_WINDOW (f) != 0) |
1484 { | |
1485 recompute_basic_faces (f); | |
1486 if (FRAME_VISIBLE_P (f)) | |
1487 redraw_frame (f); | |
1488 } | |
1489 } | |
1490 | |
1491 void | |
1492 x_set_background_color (f, arg, oldval) | |
1493 struct frame *f; | |
1494 Lisp_Object arg, oldval; | |
1495 { | |
1496 Pixmap temp; | |
1497 int mask; | |
1498 | |
1499 f->output_data.win32->background_pixel | |
1500 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); | |
1501 | |
1502 if (FRAME_WIN32_WINDOW (f) != 0) | |
1503 { | |
1504 SetWindowLong (FRAME_WIN32_WINDOW (f), WND_BACKGROUND_INDEX, f->output_data.win32->background_pixel); | |
1505 | |
1506 recompute_basic_faces (f); | |
1507 | |
1508 if (FRAME_VISIBLE_P (f)) | |
1509 redraw_frame (f); | |
1510 } | |
1511 } | |
1512 | |
1513 void | |
1514 x_set_mouse_color (f, arg, oldval) | |
1515 struct frame *f; | |
1516 Lisp_Object arg, oldval; | |
1517 { | |
1518 #if 0 | |
1519 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor; | |
1520 #endif | |
1521 int mask_color; | |
1522 | |
1523 if (!EQ (Qnil, arg)) | |
1524 f->output_data.win32->mouse_pixel | |
1525 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | |
1526 mask_color = f->output_data.win32->background_pixel; | |
1527 /* No invisible pointers. */ | |
1528 if (mask_color == f->output_data.win32->mouse_pixel | |
1529 && mask_color == f->output_data.win32->background_pixel) | |
1530 f->output_data.win32->mouse_pixel = f->output_data.win32->foreground_pixel; | |
1531 | |
1532 #if 0 | |
1533 BLOCK_INPUT; | |
1534 | |
1535 /* It's not okay to crash if the user selects a screwy cursor. */ | |
1536 x_catch_errors (FRAME_WIN32_DISPLAY (f)); | |
1537 | |
1538 if (!EQ (Qnil, Vx_pointer_shape)) | |
1539 { | |
1540 CHECK_NUMBER (Vx_pointer_shape, 0); | |
1541 cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XINT (Vx_pointer_shape)); | |
1542 } | |
1543 else | |
1544 cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_xterm); | |
1545 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad text pointer cursor: %s"); | |
1546 | |
1547 if (!EQ (Qnil, Vx_nontext_pointer_shape)) | |
1548 { | |
1549 CHECK_NUMBER (Vx_nontext_pointer_shape, 0); | |
1550 nontext_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), | |
1551 XINT (Vx_nontext_pointer_shape)); | |
1552 } | |
1553 else | |
1554 nontext_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_left_ptr); | |
1555 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad nontext pointer cursor: %s"); | |
1556 | |
1557 if (!EQ (Qnil, Vx_mode_pointer_shape)) | |
1558 { | |
1559 CHECK_NUMBER (Vx_mode_pointer_shape, 0); | |
1560 mode_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), | |
1561 XINT (Vx_mode_pointer_shape)); | |
1562 } | |
1563 else | |
1564 mode_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_xterm); | |
1565 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad modeline pointer cursor: %s"); | |
1566 | |
1567 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape)) | |
1568 { | |
1569 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0); | |
1570 cross_cursor | |
1571 = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), | |
1572 XINT (Vx_sensitive_text_pointer_shape)); | |
1573 } | |
1574 else | |
1575 cross_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_crosshair); | |
1576 | |
1577 /* Check and report errors with the above calls. */ | |
1578 x_check_errors (FRAME_WIN32_DISPLAY (f), "can't set cursor shape: %s"); | |
1579 x_uncatch_errors (FRAME_WIN32_DISPLAY (f)); | |
1580 | |
1581 { | |
1582 XColor fore_color, back_color; | |
1583 | |
1584 fore_color.pixel = f->output_data.win32->mouse_pixel; | |
1585 back_color.pixel = mask_color; | |
1586 XQueryColor (FRAME_WIN32_DISPLAY (f), | |
1587 DefaultColormap (FRAME_WIN32_DISPLAY (f), | |
1588 DefaultScreen (FRAME_WIN32_DISPLAY (f))), | |
1589 &fore_color); | |
1590 XQueryColor (FRAME_WIN32_DISPLAY (f), | |
1591 DefaultColormap (FRAME_WIN32_DISPLAY (f), | |
1592 DefaultScreen (FRAME_WIN32_DISPLAY (f))), | |
1593 &back_color); | |
1594 XRecolorCursor (FRAME_WIN32_DISPLAY (f), cursor, | |
1595 &fore_color, &back_color); | |
1596 XRecolorCursor (FRAME_WIN32_DISPLAY (f), nontext_cursor, | |
1597 &fore_color, &back_color); | |
1598 XRecolorCursor (FRAME_WIN32_DISPLAY (f), mode_cursor, | |
1599 &fore_color, &back_color); | |
1600 XRecolorCursor (FRAME_WIN32_DISPLAY (f), cross_cursor, | |
1601 &fore_color, &back_color); | |
1602 } | |
1603 | |
1604 if (FRAME_WIN32_WINDOW (f) != 0) | |
1605 { | |
1606 XDefineCursor (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f), cursor); | |
1607 } | |
1608 | |
1609 if (cursor != f->output_data.win32->text_cursor && f->output_data.win32->text_cursor != 0) | |
1610 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->text_cursor); | |
1611 f->output_data.win32->text_cursor = cursor; | |
1612 | |
1613 if (nontext_cursor != f->output_data.win32->nontext_cursor | |
1614 && f->output_data.win32->nontext_cursor != 0) | |
1615 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->nontext_cursor); | |
1616 f->output_data.win32->nontext_cursor = nontext_cursor; | |
1617 | |
1618 if (mode_cursor != f->output_data.win32->modeline_cursor | |
1619 && f->output_data.win32->modeline_cursor != 0) | |
1620 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->modeline_cursor); | |
1621 f->output_data.win32->modeline_cursor = mode_cursor; | |
1622 if (cross_cursor != f->output_data.win32->cross_cursor | |
1623 && f->output_data.win32->cross_cursor != 0) | |
1624 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->cross_cursor); | |
1625 f->output_data.win32->cross_cursor = cross_cursor; | |
1626 | |
1627 XFlush (FRAME_WIN32_DISPLAY (f)); | |
1628 UNBLOCK_INPUT; | |
1629 #endif | |
1630 } | |
1631 | |
1632 void | |
1633 x_set_cursor_color (f, arg, oldval) | |
1634 struct frame *f; | |
1635 Lisp_Object arg, oldval; | |
1636 { | |
1637 unsigned long fore_pixel; | |
1638 | |
1639 if (!EQ (Vx_cursor_fore_pixel, Qnil)) | |
1640 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, | |
1641 WHITE_PIX_DEFAULT (f)); | |
1642 else | |
1643 fore_pixel = f->output_data.win32->background_pixel; | |
1644 f->output_data.win32->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | |
1645 | |
1646 /* Make sure that the cursor color differs from the background color. */ | |
1647 if (f->output_data.win32->cursor_pixel == f->output_data.win32->background_pixel) | |
1648 { | |
1649 f->output_data.win32->cursor_pixel = f->output_data.win32->mouse_pixel; | |
1650 if (f->output_data.win32->cursor_pixel == fore_pixel) | |
1651 fore_pixel = f->output_data.win32->background_pixel; | |
1652 } | |
1653 f->output_data.win32->cursor_foreground_pixel = fore_pixel; | |
1654 | |
1655 if (FRAME_WIN32_WINDOW (f) != 0) | |
1656 { | |
1657 if (FRAME_VISIBLE_P (f)) | |
1658 { | |
1659 x_display_cursor (f, 0); | |
1660 x_display_cursor (f, 1); | |
1661 } | |
1662 } | |
1663 } | |
1664 | |
1665 /* Set the border-color of frame F to value described by ARG. | |
1666 ARG can be a string naming a color. | |
1667 The border-color is used for the border that is drawn by the server. | |
1668 Note that this does not fully take effect if done before | |
1669 F has a window; it must be redone when the window is created. */ | |
1670 | |
1671 void | |
1672 x_set_border_color (f, arg, oldval) | |
1673 struct frame *f; | |
1674 Lisp_Object arg, oldval; | |
1675 { | |
1676 unsigned char *str; | |
1677 int pix; | |
1678 | |
1679 CHECK_STRING (arg, 0); | |
1680 str = XSTRING (arg)->data; | |
1681 | |
1682 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | |
1683 | |
1684 x_set_border_pixel (f, pix); | |
1685 } | |
1686 | |
1687 /* Set the border-color of frame F to pixel value PIX. | |
1688 Note that this does not fully take effect if done before | |
1689 F has an window. */ | |
1690 | |
1691 x_set_border_pixel (f, pix) | |
1692 struct frame *f; | |
1693 int pix; | |
1694 { | |
1695 f->output_data.win32->border_pixel = pix; | |
1696 | |
1697 if (FRAME_WIN32_WINDOW (f) != 0 && f->output_data.win32->border_width > 0) | |
1698 { | |
1699 if (FRAME_VISIBLE_P (f)) | |
1700 redraw_frame (f); | |
1701 } | |
1702 } | |
1703 | |
1704 void | |
1705 x_set_cursor_type (f, arg, oldval) | |
1706 FRAME_PTR f; | |
1707 Lisp_Object arg, oldval; | |
1708 { | |
1709 if (EQ (arg, Qbar)) | |
1710 { | |
1711 FRAME_DESIRED_CURSOR (f) = bar_cursor; | |
1712 f->output_data.win32->cursor_width = 2; | |
1713 } | |
1714 else if (CONSP (arg) && EQ (XCONS (arg)->car, Qbar) | |
1715 && INTEGERP (XCONS (arg)->cdr)) | |
1716 { | |
1717 FRAME_DESIRED_CURSOR (f) = bar_cursor; | |
1718 f->output_data.win32->cursor_width = XINT (XCONS (arg)->cdr); | |
1719 } | |
1720 else | |
1721 /* Treat anything unknown as "box cursor". | |
1722 It was bad to signal an error; people have trouble fixing | |
1723 .Xdefaults with Emacs, when it has something bad in it. */ | |
1724 FRAME_DESIRED_CURSOR (f) = filled_box_cursor; | |
1725 | |
1726 /* Make sure the cursor gets redrawn. This is overkill, but how | |
1727 often do people change cursor types? */ | |
1728 update_mode_lines++; | |
1729 } | |
1730 | |
1731 void | |
1732 x_set_icon_type (f, arg, oldval) | |
1733 struct frame *f; | |
1734 Lisp_Object arg, oldval; | |
1735 { | |
1736 #if 0 | |
1737 Lisp_Object tem; | |
1738 int result; | |
1739 | |
1740 if (STRINGP (arg)) | |
1741 { | |
1742 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
1743 return; | |
1744 } | |
1745 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
1746 return; | |
1747 | |
1748 BLOCK_INPUT; | |
1749 if (NILP (arg)) | |
1750 result = x_text_icon (f, | |
1751 (char *) XSTRING ((!NILP (f->icon_name) | |
1752 ? f->icon_name | |
1753 : f->name))->data); | |
1754 else | |
1755 result = x_bitmap_icon (f, arg); | |
1756 | |
1757 if (result) | |
1758 { | |
1759 UNBLOCK_INPUT; | |
1760 error ("No icon window available"); | |
1761 } | |
1762 | |
1763 /* If the window was unmapped (and its icon was mapped), | |
1764 the new icon is not mapped, so map the window in its stead. */ | |
1765 if (FRAME_VISIBLE_P (f)) | |
1766 { | |
1767 #ifdef USE_X_TOOLKIT | |
1768 XtPopup (f->output_data.win32->widget, XtGrabNone); | |
1769 #endif | |
1770 XMapWindow (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f)); | |
1771 } | |
1772 | |
1773 XFlush (FRAME_WIN32_DISPLAY (f)); | |
1774 UNBLOCK_INPUT; | |
1775 #endif | |
1776 } | |
1777 | |
1778 /* Return non-nil if frame F wants a bitmap icon. */ | |
1779 | |
1780 Lisp_Object | |
1781 x_icon_type (f) | |
1782 FRAME_PTR f; | |
1783 { | |
1784 Lisp_Object tem; | |
1785 | |
1786 tem = assq_no_quit (Qicon_type, f->param_alist); | |
1787 if (CONSP (tem)) | |
1788 return XCONS (tem)->cdr; | |
1789 else | |
1790 return Qnil; | |
1791 } | |
1792 | |
1793 void | |
1794 x_set_icon_name (f, arg, oldval) | |
1795 struct frame *f; | |
1796 Lisp_Object arg, oldval; | |
1797 { | |
1798 Lisp_Object tem; | |
1799 int result; | |
1800 | |
1801 if (STRINGP (arg)) | |
1802 { | |
1803 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
1804 return; | |
1805 } | |
1806 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
1807 return; | |
1808 | |
1809 f->icon_name = arg; | |
1810 | |
1811 #if 0 | |
1812 if (f->output_data.win32->icon_bitmap != 0) | |
1813 return; | |
1814 | |
1815 BLOCK_INPUT; | |
1816 | |
1817 result = x_text_icon (f, | |
1818 (char *) XSTRING ((!NILP (f->icon_name) | |
1819 ? f->icon_name | |
1820 : f->name))->data); | |
1821 | |
1822 if (result) | |
1823 { | |
1824 UNBLOCK_INPUT; | |
1825 error ("No icon window available"); | |
1826 } | |
1827 | |
1828 /* If the window was unmapped (and its icon was mapped), | |
1829 the new icon is not mapped, so map the window in its stead. */ | |
1830 if (FRAME_VISIBLE_P (f)) | |
1831 { | |
1832 #ifdef USE_X_TOOLKIT | |
1833 XtPopup (f->output_data.win32->widget, XtGrabNone); | |
1834 #endif | |
1835 XMapWindow (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f)); | |
1836 } | |
1837 | |
1838 XFlush (FRAME_WIN32_DISPLAY (f)); | |
1839 UNBLOCK_INPUT; | |
1840 #endif | |
1841 } | |
1842 | |
1843 extern Lisp_Object x_new_font (); | |
1844 | |
1845 void | |
1846 x_set_font (f, arg, oldval) | |
1847 struct frame *f; | |
1848 Lisp_Object arg, oldval; | |
1849 { | |
1850 Lisp_Object result; | |
1851 | |
1852 CHECK_STRING (arg, 1); | |
1853 | |
1854 BLOCK_INPUT; | |
1855 result = x_new_font (f, XSTRING (arg)->data); | |
1856 UNBLOCK_INPUT; | |
1857 | |
1858 if (EQ (result, Qnil)) | |
1859 error ("Font \"%s\" is not defined", XSTRING (arg)->data); | |
1860 else if (EQ (result, Qt)) | |
1861 error ("the characters of the given font have varying widths"); | |
1862 else if (STRINGP (result)) | |
1863 { | |
1864 recompute_basic_faces (f); | |
1865 store_frame_param (f, Qfont, result); | |
1866 } | |
1867 else | |
1868 abort (); | |
1869 } | |
1870 | |
1871 void | |
1872 x_set_border_width (f, arg, oldval) | |
1873 struct frame *f; | |
1874 Lisp_Object arg, oldval; | |
1875 { | |
1876 CHECK_NUMBER (arg, 0); | |
1877 | |
1878 if (XINT (arg) == f->output_data.win32->border_width) | |
1879 return; | |
1880 | |
1881 if (FRAME_WIN32_WINDOW (f) != 0) | |
1882 error ("Cannot change the border width of a window"); | |
1883 | |
1884 f->output_data.win32->border_width = XINT (arg); | |
1885 } | |
1886 | |
1887 void | |
1888 x_set_internal_border_width (f, arg, oldval) | |
1889 struct frame *f; | |
1890 Lisp_Object arg, oldval; | |
1891 { | |
1892 int mask; | |
1893 int old = f->output_data.win32->internal_border_width; | |
1894 | |
1895 CHECK_NUMBER (arg, 0); | |
1896 f->output_data.win32->internal_border_width = XINT (arg); | |
1897 if (f->output_data.win32->internal_border_width < 0) | |
1898 f->output_data.win32->internal_border_width = 0; | |
1899 | |
1900 if (f->output_data.win32->internal_border_width == old) | |
1901 return; | |
1902 | |
1903 if (FRAME_WIN32_WINDOW (f) != 0) | |
1904 { | |
1905 BLOCK_INPUT; | |
1906 x_set_window_size (f, 0, f->width, f->height); | |
1907 UNBLOCK_INPUT; | |
1908 SET_FRAME_GARBAGED (f); | |
1909 } | |
1910 } | |
1911 | |
1912 void | |
1913 x_set_visibility (f, value, oldval) | |
1914 struct frame *f; | |
1915 Lisp_Object value, oldval; | |
1916 { | |
1917 Lisp_Object frame; | |
1918 XSETFRAME (frame, f); | |
1919 | |
1920 if (NILP (value)) | |
1921 Fmake_frame_invisible (frame, Qt); | |
1922 else if (EQ (value, Qicon)) | |
1923 Ficonify_frame (frame); | |
1924 else | |
1925 Fmake_frame_visible (frame); | |
1926 } | |
1927 | |
1928 void | |
1929 x_set_menu_bar_lines (f, value, oldval) | |
1930 struct frame *f; | |
1931 Lisp_Object value, oldval; | |
1932 { | |
1933 int nlines; | |
1934 int olines = FRAME_MENU_BAR_LINES (f); | |
1935 | |
1936 /* Right now, menu bars don't work properly in minibuf-only frames; | |
1937 most of the commands try to apply themselves to the minibuffer | |
1938 frame itslef, and get an error because you can't switch buffers | |
1939 in or split the minibuffer window. */ | |
1940 if (FRAME_MINIBUF_ONLY_P (f)) | |
1941 return; | |
1942 | |
1943 if (INTEGERP (value)) | |
1944 nlines = XINT (value); | |
1945 else | |
1946 nlines = 0; | |
1947 | |
1948 FRAME_MENU_BAR_LINES (f) = 0; | |
1949 if (nlines) | |
1950 FRAME_EXTERNAL_MENU_BAR (f) = 1; | |
1951 else | |
1952 { | |
1953 if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | |
1954 free_frame_menubar (f); | |
1955 FRAME_EXTERNAL_MENU_BAR (f) = 0; | |
1956 } | |
1957 } | |
1958 | |
1959 /* Change the name of frame F to NAME. If NAME is nil, set F's name to | |
1960 win32_id_name. | |
1961 | |
1962 If EXPLICIT is non-zero, that indicates that lisp code is setting the | |
1963 name; if NAME is a string, set F's name to NAME and set | |
1964 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. | |
1965 | |
1966 If EXPLICIT is zero, that indicates that Emacs redisplay code is | |
1967 suggesting a new name, which lisp code should override; if | |
1968 F->explicit_name is set, ignore the new name; otherwise, set it. */ | |
1969 | |
1970 void | |
1971 x_set_name (f, name, explicit) | |
1972 struct frame *f; | |
1973 Lisp_Object name; | |
1974 int explicit; | |
1975 { | |
1976 /* Make sure that requests from lisp code override requests from | |
1977 Emacs redisplay code. */ | |
1978 if (explicit) | |
1979 { | |
1980 /* If we're switching from explicit to implicit, we had better | |
1981 update the mode lines and thereby update the title. */ | |
1982 if (f->explicit_name && NILP (name)) | |
1983 update_mode_lines = 1; | |
1984 | |
1985 f->explicit_name = ! NILP (name); | |
1986 } | |
1987 else if (f->explicit_name) | |
1988 return; | |
1989 | |
1990 /* If NAME is nil, set the name to the win32_id_name. */ | |
1991 if (NILP (name)) | |
1992 { | |
1993 /* Check for no change needed in this very common case | |
1994 before we do any consing. */ | |
1995 if (!strcmp (FRAME_WIN32_DISPLAY_INFO (f)->win32_id_name, | |
1996 XSTRING (f->name)->data)) | |
1997 return; | |
1998 name = build_string (FRAME_WIN32_DISPLAY_INFO (f)->win32_id_name); | |
1999 } | |
2000 else | |
2001 CHECK_STRING (name, 0); | |
2002 | |
2003 /* Don't change the name if it's already NAME. */ | |
2004 if (! NILP (Fstring_equal (name, f->name))) | |
2005 return; | |
2006 | |
2007 if (FRAME_WIN32_WINDOW (f)) | |
2008 { | |
2009 BLOCK_INPUT; | |
2010 SetWindowText(FRAME_WIN32_WINDOW (f), XSTRING (name)->data); | |
2011 UNBLOCK_INPUT; | |
2012 } | |
2013 | |
2014 f->name = name; | |
2015 } | |
2016 | |
2017 /* This function should be called when the user's lisp code has | |
2018 specified a name for the frame; the name will override any set by the | |
2019 redisplay code. */ | |
2020 void | |
2021 x_explicitly_set_name (f, arg, oldval) | |
2022 FRAME_PTR f; | |
2023 Lisp_Object arg, oldval; | |
2024 { | |
2025 x_set_name (f, arg, 1); | |
2026 } | |
2027 | |
2028 /* This function should be called by Emacs redisplay code to set the | |
2029 name; names set this way will never override names set by the user's | |
2030 lisp code. */ | |
2031 void | |
2032 x_implicitly_set_name (f, arg, oldval) | |
2033 FRAME_PTR f; | |
2034 Lisp_Object arg, oldval; | |
2035 { | |
2036 x_set_name (f, arg, 0); | |
2037 } | |
2038 | |
2039 void | |
2040 x_set_autoraise (f, arg, oldval) | |
2041 struct frame *f; | |
2042 Lisp_Object arg, oldval; | |
2043 { | |
2044 f->auto_raise = !EQ (Qnil, arg); | |
2045 } | |
2046 | |
2047 void | |
2048 x_set_autolower (f, arg, oldval) | |
2049 struct frame *f; | |
2050 Lisp_Object arg, oldval; | |
2051 { | |
2052 f->auto_lower = !EQ (Qnil, arg); | |
2053 } | |
2054 | |
2055 void | |
2056 x_set_unsplittable (f, arg, oldval) | |
2057 struct frame *f; | |
2058 Lisp_Object arg, oldval; | |
2059 { | |
2060 f->no_split = !NILP (arg); | |
2061 } | |
2062 | |
2063 void | |
2064 x_set_vertical_scroll_bars (f, arg, oldval) | |
2065 struct frame *f; | |
2066 Lisp_Object arg, oldval; | |
2067 { | |
2068 if (NILP (arg) != ! FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | |
2069 { | |
2070 FRAME_HAS_VERTICAL_SCROLL_BARS (f) = ! NILP (arg); | |
2071 | |
2072 /* We set this parameter before creating the window for the | |
2073 frame, so we can get the geometry right from the start. | |
2074 However, if the window hasn't been created yet, we shouldn't | |
2075 call x_set_window_size. */ | |
2076 if (FRAME_WIN32_WINDOW (f)) | |
2077 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); | |
2078 } | |
2079 } | |
2080 | |
2081 void | |
2082 x_set_scroll_bar_width (f, arg, oldval) | |
2083 struct frame *f; | |
2084 Lisp_Object arg, oldval; | |
2085 { | |
2086 if (NILP (arg)) | |
2087 { | |
2088 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0; | |
2089 FRAME_SCROLL_BAR_COLS (f) = 2; | |
2090 } | |
2091 else if (INTEGERP (arg) && XINT (arg) > 0 | |
2092 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f)) | |
2093 { | |
2094 int wid = FONT_WIDTH (f->output_data.win32->font); | |
2095 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg); | |
2096 FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid; | |
2097 if (FRAME_WIN32_WINDOW (f)) | |
2098 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); | |
2099 } | |
2100 } | |
2101 | |
2102 /* Subroutines of creating an frame. */ | |
2103 | |
2104 /* Make sure that Vx_resource_name is set to a reasonable value. | |
2105 Fix it up, or set it to `emacs' if it is too hopeless. */ | |
2106 | |
2107 static void | |
2108 validate_x_resource_name () | |
2109 { | |
2110 int len; | |
2111 /* Number of valid characters in the resource name. */ | |
2112 int good_count = 0; | |
2113 /* Number of invalid characters in the resource name. */ | |
2114 int bad_count = 0; | |
2115 Lisp_Object new; | |
2116 int i; | |
2117 | |
2118 if (STRINGP (Vx_resource_name)) | |
2119 { | |
2120 unsigned char *p = XSTRING (Vx_resource_name)->data; | |
2121 int i; | |
2122 | |
2123 len = XSTRING (Vx_resource_name)->size; | |
2124 | |
2125 /* Only letters, digits, - and _ are valid in resource names. | |
2126 Count the valid characters and count the invalid ones. */ | |
2127 for (i = 0; i < len; i++) | |
2128 { | |
2129 int c = p[i]; | |
2130 if (! ((c >= 'a' && c <= 'z') | |
2131 || (c >= 'A' && c <= 'Z') | |
2132 || (c >= '0' && c <= '9') | |
2133 || c == '-' || c == '_')) | |
2134 bad_count++; | |
2135 else | |
2136 good_count++; | |
2137 } | |
2138 } | |
2139 else | |
2140 /* Not a string => completely invalid. */ | |
2141 bad_count = 5, good_count = 0; | |
2142 | |
2143 /* If name is valid already, return. */ | |
2144 if (bad_count == 0) | |
2145 return; | |
2146 | |
2147 /* If name is entirely invalid, or nearly so, use `emacs'. */ | |
2148 if (good_count == 0 | |
2149 || (good_count == 1 && bad_count > 0)) | |
2150 { | |
2151 Vx_resource_name = build_string ("emacs"); | |
2152 return; | |
2153 } | |
2154 | |
2155 /* Name is partly valid. Copy it and replace the invalid characters | |
2156 with underscores. */ | |
2157 | |
2158 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name); | |
2159 | |
2160 for (i = 0; i < len; i++) | |
2161 { | |
2162 int c = XSTRING (new)->data[i]; | |
2163 if (! ((c >= 'a' && c <= 'z') | |
2164 || (c >= 'A' && c <= 'Z') | |
2165 || (c >= '0' && c <= '9') | |
2166 || c == '-' || c == '_')) | |
2167 XSTRING (new)->data[i] = '_'; | |
2168 } | |
2169 } | |
2170 | |
2171 | |
2172 extern char *x_get_string_resource (); | |
2173 | |
2174 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0, | |
2175 "Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.\n\ | |
2176 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the\n\ | |
2177 class, where INSTANCE is the name under which Emacs was invoked, or\n\ | |
2178 the name specified by the `-name' or `-rn' command-line arguments.\n\ | |
2179 \n\ | |
2180 The optional arguments COMPONENT and SUBCLASS add to the key and the\n\ | |
2181 class, respectively. You must specify both of them or neither.\n\ | |
2182 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\ | |
2183 and the class is `Emacs.CLASS.SUBCLASS'.") | |
2184 (attribute, class, component, subclass) | |
2185 Lisp_Object attribute, class, component, subclass; | |
2186 { | |
2187 register char *value; | |
2188 char *name_key; | |
2189 char *class_key; | |
2190 | |
2191 CHECK_STRING (attribute, 0); | |
2192 CHECK_STRING (class, 0); | |
2193 | |
2194 if (!NILP (component)) | |
2195 CHECK_STRING (component, 1); | |
2196 if (!NILP (subclass)) | |
2197 CHECK_STRING (subclass, 2); | |
2198 if (NILP (component) != NILP (subclass)) | |
2199 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | |
2200 | |
2201 validate_x_resource_name (); | |
2202 | |
2203 /* Allocate space for the components, the dots which separate them, | |
2204 and the final '\0'. Make them big enough for the worst case. */ | |
2205 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size | |
2206 + (STRINGP (component) | |
2207 ? XSTRING (component)->size : 0) | |
2208 + XSTRING (attribute)->size | |
2209 + 3); | |
2210 | |
2211 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
2212 + XSTRING (class)->size | |
2213 + (STRINGP (subclass) | |
2214 ? XSTRING (subclass)->size : 0) | |
2215 + 3); | |
2216 | |
2217 /* Start with emacs.FRAMENAME for the name (the specific one) | |
2218 and with `Emacs' for the class key (the general one). */ | |
2219 strcpy (name_key, XSTRING (Vx_resource_name)->data); | |
2220 strcpy (class_key, EMACS_CLASS); | |
2221 | |
2222 strcat (class_key, "."); | |
2223 strcat (class_key, XSTRING (class)->data); | |
2224 | |
2225 if (!NILP (component)) | |
2226 { | |
2227 strcat (class_key, "."); | |
2228 strcat (class_key, XSTRING (subclass)->data); | |
2229 | |
2230 strcat (name_key, "."); | |
2231 strcat (name_key, XSTRING (component)->data); | |
2232 } | |
2233 | |
2234 strcat (name_key, "."); | |
2235 strcat (name_key, XSTRING (attribute)->data); | |
2236 | |
2237 value = x_get_string_resource (Qnil, | |
2238 name_key, class_key); | |
2239 | |
2240 if (value != (char *) 0) | |
2241 return build_string (value); | |
2242 else | |
2243 return Qnil; | |
2244 } | |
2245 | |
2246 /* Used when C code wants a resource value. */ | |
2247 | |
2248 char * | |
2249 x_get_resource_string (attribute, class) | |
2250 char *attribute, *class; | |
2251 { | |
2252 register char *value; | |
2253 char *name_key; | |
2254 char *class_key; | |
2255 | |
2256 /* Allocate space for the components, the dots which separate them, | |
2257 and the final '\0'. */ | |
2258 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size | |
2259 + strlen (attribute) + 2); | |
2260 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
2261 + strlen (class) + 2); | |
2262 | |
2263 sprintf (name_key, "%s.%s", | |
2264 XSTRING (Vinvocation_name)->data, | |
2265 attribute); | |
2266 sprintf (class_key, "%s.%s", EMACS_CLASS, class); | |
2267 | |
2268 return x_get_string_resource (selected_frame, | |
2269 name_key, class_key); | |
2270 } | |
2271 | |
2272 /* Types we might convert a resource string into. */ | |
2273 enum resource_types | |
2274 { | |
2275 number, boolean, string, symbol | |
2276 }; | |
2277 | |
2278 /* Return the value of parameter PARAM. | |
2279 | |
2280 First search ALIST, then Vdefault_frame_alist, then the X defaults | |
2281 database, using ATTRIBUTE as the attribute name and CLASS as its class. | |
2282 | |
2283 Convert the resource to the type specified by desired_type. | |
2284 | |
2285 If no default is specified, return Qunbound. If you call | |
2286 x_get_arg, make sure you deal with Qunbound in a reasonable way, | |
2287 and don't let it get stored in any Lisp-visible variables! */ | |
2288 | |
2289 static Lisp_Object | |
2290 x_get_arg (alist, param, attribute, class, type) | |
2291 Lisp_Object alist, param; | |
2292 char *attribute; | |
2293 char *class; | |
2294 enum resource_types type; | |
2295 { | |
2296 register Lisp_Object tem; | |
2297 | |
2298 tem = Fassq (param, alist); | |
2299 if (EQ (tem, Qnil)) | |
2300 tem = Fassq (param, Vdefault_frame_alist); | |
2301 if (EQ (tem, Qnil)) | |
2302 { | |
2303 | |
2304 if (attribute) | |
2305 { | |
2306 tem = Fx_get_resource (build_string (attribute), | |
2307 build_string (class), | |
2308 Qnil, Qnil); | |
2309 | |
2310 if (NILP (tem)) | |
2311 return Qunbound; | |
2312 | |
2313 switch (type) | |
2314 { | |
2315 case number: | |
2316 return make_number (atoi (XSTRING (tem)->data)); | |
2317 | |
2318 case boolean: | |
2319 tem = Fdowncase (tem); | |
2320 if (!strcmp (XSTRING (tem)->data, "on") | |
2321 || !strcmp (XSTRING (tem)->data, "true")) | |
2322 return Qt; | |
2323 else | |
2324 return Qnil; | |
2325 | |
2326 case string: | |
2327 return tem; | |
2328 | |
2329 case symbol: | |
2330 /* As a special case, we map the values `true' and `on' | |
2331 to Qt, and `false' and `off' to Qnil. */ | |
2332 { | |
2333 Lisp_Object lower; | |
2334 lower = Fdowncase (tem); | |
2335 if (!strcmp (XSTRING (lower)->data, "on") | |
2336 || !strcmp (XSTRING (lower)->data, "true")) | |
2337 return Qt; | |
2338 else if (!strcmp (XSTRING (lower)->data, "off") | |
2339 || !strcmp (XSTRING (lower)->data, "false")) | |
2340 return Qnil; | |
2341 else | |
2342 return Fintern (tem, Qnil); | |
2343 } | |
2344 | |
2345 default: | |
2346 abort (); | |
2347 } | |
2348 } | |
2349 else | |
2350 return Qunbound; | |
2351 } | |
2352 return Fcdr (tem); | |
2353 } | |
2354 | |
2355 /* Record in frame F the specified or default value according to ALIST | |
2356 of the parameter named PARAM (a Lisp symbol). | |
2357 If no value is specified for PARAM, look for an X default for XPROP | |
2358 on the frame named NAME. | |
2359 If that is not found either, use the value DEFLT. */ | |
2360 | |
2361 static Lisp_Object | |
2362 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) | |
2363 struct frame *f; | |
2364 Lisp_Object alist; | |
2365 Lisp_Object prop; | |
2366 Lisp_Object deflt; | |
2367 char *xprop; | |
2368 char *xclass; | |
2369 enum resource_types type; | |
2370 { | |
2371 Lisp_Object tem; | |
2372 | |
2373 tem = x_get_arg (alist, prop, xprop, xclass, type); | |
2374 if (EQ (tem, Qunbound)) | |
2375 tem = deflt; | |
2376 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); | |
2377 return tem; | |
2378 } | |
2379 | |
2380 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0, | |
2381 "Parse an X-style geometry string STRING.\n\ | |
2382 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\ | |
2383 The properties returned may include `top', `left', `height', and `width'.\n\ | |
2384 The value of `left' or `top' may be an integer,\n\ | |
2385 or a list (+ N) meaning N pixels relative to top/left corner,\n\ | |
2386 or a list (- N) meaning -N pixels relative to bottom/right corner.") | |
2387 (string) | |
2388 Lisp_Object string; | |
2389 { | |
2390 int geometry, x, y; | |
2391 unsigned int width, height; | |
2392 Lisp_Object result; | |
2393 | |
2394 CHECK_STRING (string, 0); | |
2395 | |
2396 geometry = XParseGeometry ((char *) XSTRING (string)->data, | |
2397 &x, &y, &width, &height); | |
2398 | |
2399 result = Qnil; | |
2400 if (geometry & XValue) | |
2401 { | |
2402 Lisp_Object element; | |
2403 | |
2404 if (x >= 0 && (geometry & XNegative)) | |
2405 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil))); | |
2406 else if (x < 0 && ! (geometry & XNegative)) | |
2407 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil))); | |
2408 else | |
2409 element = Fcons (Qleft, make_number (x)); | |
2410 result = Fcons (element, result); | |
2411 } | |
2412 | |
2413 if (geometry & YValue) | |
2414 { | |
2415 Lisp_Object element; | |
2416 | |
2417 if (y >= 0 && (geometry & YNegative)) | |
2418 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil))); | |
2419 else if (y < 0 && ! (geometry & YNegative)) | |
2420 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil))); | |
2421 else | |
2422 element = Fcons (Qtop, make_number (y)); | |
2423 result = Fcons (element, result); | |
2424 } | |
2425 | |
2426 if (geometry & WidthValue) | |
2427 result = Fcons (Fcons (Qwidth, make_number (width)), result); | |
2428 if (geometry & HeightValue) | |
2429 result = Fcons (Fcons (Qheight, make_number (height)), result); | |
2430 | |
2431 return result; | |
2432 } | |
2433 | |
2434 /* Calculate the desired size and position of this window, | |
2435 and return the flags saying which aspects were specified. | |
2436 | |
2437 This function does not make the coordinates positive. */ | |
2438 | |
2439 #define DEFAULT_ROWS 40 | |
2440 #define DEFAULT_COLS 80 | |
2441 | |
2442 static int | |
2443 x_figure_window_size (f, parms) | |
2444 struct frame *f; | |
2445 Lisp_Object parms; | |
2446 { | |
2447 register Lisp_Object tem0, tem1, tem2; | |
2448 int height, width, left, top; | |
2449 register int geometry; | |
2450 long window_prompting = 0; | |
2451 | |
2452 /* Default values if we fall through. | |
2453 Actually, if that happens we should get | |
2454 window manager prompting. */ | |
2455 f->width = DEFAULT_COLS; | |
2456 f->height = DEFAULT_ROWS; | |
2457 /* Window managers expect that if program-specified | |
2458 positions are not (0,0), they're intentional, not defaults. */ | |
2459 f->output_data.win32->top_pos = 0; | |
2460 f->output_data.win32->left_pos = 0; | |
2461 | |
2462 tem0 = x_get_arg (parms, Qheight, 0, 0, number); | |
2463 tem1 = x_get_arg (parms, Qwidth, 0, 0, number); | |
2464 tem2 = x_get_arg (parms, Quser_size, 0, 0, number); | |
2465 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | |
2466 { | |
2467 if (!EQ (tem0, Qunbound)) | |
2468 { | |
2469 CHECK_NUMBER (tem0, 0); | |
2470 f->height = XINT (tem0); | |
2471 } | |
2472 if (!EQ (tem1, Qunbound)) | |
2473 { | |
2474 CHECK_NUMBER (tem1, 0); | |
2475 f->width = XINT (tem1); | |
2476 } | |
2477 if (!NILP (tem2) && !EQ (tem2, Qunbound)) | |
2478 window_prompting |= USSize; | |
2479 else | |
2480 window_prompting |= PSize; | |
2481 } | |
2482 | |
2483 f->output_data.win32->vertical_scroll_bar_extra | |
2484 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) | |
2485 ? 0 | |
2486 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
2487 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) | |
2488 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.win32->font))); | |
2489 f->output_data.win32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); | |
2490 f->output_data.win32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); | |
2491 | |
2492 tem0 = x_get_arg (parms, Qtop, 0, 0, number); | |
2493 tem1 = x_get_arg (parms, Qleft, 0, 0, number); | |
2494 tem2 = x_get_arg (parms, Quser_position, 0, 0, number); | |
2495 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | |
2496 { | |
2497 if (EQ (tem0, Qminus)) | |
2498 { | |
2499 f->output_data.win32->top_pos = 0; | |
2500 window_prompting |= YNegative; | |
2501 } | |
2502 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus) | |
2503 && CONSP (XCONS (tem0)->cdr) | |
2504 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car)) | |
2505 { | |
2506 f->output_data.win32->top_pos = - XINT (XCONS (XCONS (tem0)->cdr)->car); | |
2507 window_prompting |= YNegative; | |
2508 } | |
2509 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus) | |
2510 && CONSP (XCONS (tem0)->cdr) | |
2511 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car)) | |
2512 { | |
2513 f->output_data.win32->top_pos = XINT (XCONS (XCONS (tem0)->cdr)->car); | |
2514 } | |
2515 else if (EQ (tem0, Qunbound)) | |
2516 f->output_data.win32->top_pos = 0; | |
2517 else | |
2518 { | |
2519 CHECK_NUMBER (tem0, 0); | |
2520 f->output_data.win32->top_pos = XINT (tem0); | |
2521 if (f->output_data.win32->top_pos < 0) | |
2522 window_prompting |= YNegative; | |
2523 } | |
2524 | |
2525 if (EQ (tem1, Qminus)) | |
2526 { | |
2527 f->output_data.win32->left_pos = 0; | |
2528 window_prompting |= XNegative; | |
2529 } | |
2530 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus) | |
2531 && CONSP (XCONS (tem1)->cdr) | |
2532 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car)) | |
2533 { | |
2534 f->output_data.win32->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car); | |
2535 window_prompting |= XNegative; | |
2536 } | |
2537 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus) | |
2538 && CONSP (XCONS (tem1)->cdr) | |
2539 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car)) | |
2540 { | |
2541 f->output_data.win32->left_pos = XINT (XCONS (XCONS (tem1)->cdr)->car); | |
2542 } | |
2543 else if (EQ (tem1, Qunbound)) | |
2544 f->output_data.win32->left_pos = 0; | |
2545 else | |
2546 { | |
2547 CHECK_NUMBER (tem1, 0); | |
2548 f->output_data.win32->left_pos = XINT (tem1); | |
2549 if (f->output_data.win32->left_pos < 0) | |
2550 window_prompting |= XNegative; | |
2551 } | |
2552 | |
2553 if (!NILP (tem2) && ! EQ (tem2, Qunbound)) | |
2554 window_prompting |= USPosition; | |
2555 else | |
2556 window_prompting |= PPosition; | |
2557 } | |
2558 | |
2559 return window_prompting; | |
2560 } | |
2561 | |
2562 | |
2563 | |
2564 extern LRESULT CALLBACK win32_wnd_proc (); | |
2565 | |
2566 BOOL | |
2567 win32_init_class (hinst) | |
2568 HINSTANCE hinst; | |
2569 { | |
2570 WNDCLASS wc; | |
2571 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2572 wc.style = CS_HREDRAW | CS_VREDRAW; |
13434 | 2573 wc.lpfnWndProc = (WNDPROC) win32_wnd_proc; |
2574 wc.cbClsExtra = 0; | |
2575 wc.cbWndExtra = WND_EXTRA_BYTES; | |
2576 wc.hInstance = hinst; | |
2577 wc.hIcon = LoadIcon (hinst, EMACS_CLASS); | |
2578 wc.hCursor = LoadCursor (NULL, IDC_ARROW); | |
2579 wc.hbrBackground = NULL; // GetStockObject (WHITE_BRUSH); | |
2580 wc.lpszMenuName = NULL; | |
2581 wc.lpszClassName = EMACS_CLASS; | |
2582 | |
2583 return (RegisterClass (&wc)); | |
2584 } | |
2585 | |
2586 HWND | |
2587 win32_createscrollbar (f, bar) | |
2588 struct frame *f; | |
2589 struct scroll_bar * bar; | |
2590 { | |
2591 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, | |
2592 /* Position and size of scroll bar. */ | |
2593 XINT(bar->left), XINT(bar->top), | |
2594 XINT(bar->width), XINT(bar->height), | |
2595 FRAME_WIN32_WINDOW (f), | |
2596 NULL, | |
2597 hinst, | |
2598 NULL)); | |
2599 } | |
2600 | |
2601 void | |
2602 win32_createwindow (f) | |
2603 struct frame *f; | |
2604 { | |
2605 HWND hwnd; | |
2606 | |
2607 /* Do first time app init */ | |
2608 | |
2609 if (!hprevinst) | |
2610 { | |
2611 win32_init_class (hinst); | |
2612 } | |
2613 | |
2614 FRAME_WIN32_WINDOW (f) = hwnd = CreateWindow (EMACS_CLASS, | |
2615 f->namebuf, | |
2616 f->output_data.win32->dwStyle | WS_CLIPCHILDREN, | |
2617 f->output_data.win32->left_pos, | |
2618 f->output_data.win32->top_pos, | |
2619 PIXEL_WIDTH (f), | |
2620 PIXEL_HEIGHT (f), | |
2621 NULL, | |
2622 NULL, | |
2623 hinst, | |
2624 NULL); | |
2625 | |
2626 if (hwnd) | |
2627 { | |
2628 SetWindowLong (hwnd, WND_X_UNITS_INDEX, FONT_WIDTH (f->output_data.win32->font)); | |
2629 SetWindowLong (hwnd, WND_Y_UNITS_INDEX, f->output_data.win32->line_height); | |
2630 SetWindowLong (hwnd, WND_BACKGROUND_INDEX, f->output_data.win32->background_pixel); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2631 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2632 /* Do this to discard the default setting specified by our parent. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2633 ShowWindow (hwnd, SW_HIDE); |
13434 | 2634 } |
2635 } | |
2636 | |
2637 /* Convert between the modifier bits Win32 uses and the modifier bits | |
2638 Emacs uses. */ | |
2639 unsigned int | |
2640 win32_get_modifiers () | |
2641 { | |
2642 return (((GetKeyState (VK_SHIFT)&0x8000) ? shift_modifier : 0) | | |
2643 ((GetKeyState (VK_CONTROL)&0x8000) ? ctrl_modifier : 0) | | |
2644 ((GetKeyState (VK_MENU)&0x8000) ? meta_modifier : 0)); | |
2645 } | |
2646 | |
2647 void | |
2648 my_post_msg (wmsg, hwnd, msg, wParam, lParam) | |
2649 Win32Msg * wmsg; | |
2650 HWND hwnd; | |
2651 UINT msg; | |
2652 WPARAM wParam; | |
2653 LPARAM lParam; | |
2654 { | |
2655 wmsg->msg.hwnd = hwnd; | |
2656 wmsg->msg.message = msg; | |
2657 wmsg->msg.wParam = wParam; | |
2658 wmsg->msg.lParam = lParam; | |
2659 wmsg->msg.time = GetMessageTime (); | |
2660 | |
2661 post_msg (wmsg); | |
2662 } | |
2663 | |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2664 /* GetKeyState and MapVirtualKey on Win95 do not actually distinguish |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2665 between left and right keys as advertised. We test for this |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2666 support dynamically, and set a flag when the support is absent. If |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2667 absent, we keep track of the left and right control and alt keys |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2668 ourselves. This is particularly necessary on keyboards that rely |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2669 upon the AltGr key, which is represented as having the left control |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2670 and right alt keys pressed. For these keyboards, we need to know |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2671 when the left alt key has been pressed in addition to the AltGr key |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2672 so that we can properly support M-AltGr-key sequences (such as M-@ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2673 on Swedish keyboards). */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2674 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2675 #define EMACS_LCONTROL 0 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2676 #define EMACS_RCONTROL 1 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2677 #define EMACS_LMENU 2 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2678 #define EMACS_RMENU 3 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2679 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2680 static int modifiers[4]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2681 static int modifiers_recorded; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2682 static int modifier_key_support_tested; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2683 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2684 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2685 test_modifier_support (unsigned int wparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2686 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2687 unsigned int l, r; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2688 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2689 if (wparam != VK_CONTROL && wparam != VK_MENU) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2690 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2691 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2692 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2693 l = VK_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2694 r = VK_RCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2695 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2696 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2697 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2698 l = VK_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2699 r = VK_RMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2700 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2701 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000)) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2702 modifiers_recorded = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2703 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2704 modifiers_recorded = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2705 modifier_key_support_tested = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2706 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2707 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2708 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2709 record_keydown (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2710 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2711 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2712 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2713 if (!modifier_key_support_tested) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2714 test_modifier_support (wparam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2715 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2716 if ((wparam != VK_CONTROL && wparam != VK_MENU) || !modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2717 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2718 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2719 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2720 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2721 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2722 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2723 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2724 modifiers[i] = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2725 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2726 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2727 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2728 record_keyup (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2729 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2730 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2731 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2732 if ((wparam != VK_CONTROL && wparam != VK_MENU) || !modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2733 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2734 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2735 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2736 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2737 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2738 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2739 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2740 modifiers[i] = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2741 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2742 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2743 /* Emacs can lose focus while a modifier key has been pressed. When |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2744 it regains focus, be conservative and clear all modifiers since |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2745 we cannot reconstruct the left and right modifier state. */ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2746 static void |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2747 reset_modifiers () |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2748 { |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2749 if (!modifiers_recorded) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2750 return; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2751 bzero (modifiers, sizeof (modifiers)); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2752 } |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2753 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2754 static int |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2755 modifier_set (int vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2756 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2757 if (!modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2758 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2759 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2760 switch (vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2761 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2762 case VK_LCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2763 return modifiers[EMACS_LCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2764 case VK_RCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2765 return modifiers[EMACS_RCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2766 case VK_LMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2767 return modifiers[EMACS_LMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2768 case VK_RMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2769 return modifiers[EMACS_RMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2770 case VK_CAPITAL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2771 return (GetKeyState (vkey) & 0x1); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2772 default: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2773 break; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2774 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2775 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2776 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2777 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2778 /* We map the VK_* modifiers into console modifier constants |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2779 so that we can use the same routines to handle both console |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2780 and window input. */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2781 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2782 static int |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2783 construct_modifiers (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2784 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2785 int mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2786 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2787 if (wparam != VK_CONTROL && wparam != VK_MENU) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2788 mods = GetLastError (); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2789 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2790 mods = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2791 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2792 mods |= (modifier_set (VK_CAPITAL)) ? CAPSLOCK_ON : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2793 mods |= (modifier_set (VK_LCONTROL)) ? LEFT_CTRL_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2794 mods |= (modifier_set (VK_RCONTROL)) ? RIGHT_CTRL_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2795 mods |= (modifier_set (VK_LMENU)) ? LEFT_ALT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2796 mods |= (modifier_set (VK_RMENU)) ? RIGHT_ALT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2797 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2798 return mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2799 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2800 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2801 static unsigned int |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2802 map_keypad_keys (unsigned int wparam, unsigned int lparam) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2803 { |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2804 unsigned int extended = (lparam & 0x1000000L); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2805 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2806 if (wparam < VK_CLEAR || wparam > VK_DELETE) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2807 return wparam; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2808 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2809 if (wparam == VK_RETURN) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2810 return (extended ? VK_NUMPAD_ENTER : VK_RETURN); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2811 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2812 if (wparam >= VK_PRIOR && wparam <= VK_DOWN) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2813 return (!extended ? (VK_NUMPAD_PRIOR + (wparam - VK_PRIOR)) : wparam); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2814 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2815 if (wparam == VK_INSERT || wparam == VK_DELETE) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2816 return (!extended ? (VK_NUMPAD_INSERT + (wparam - VK_INSERT)) : wparam); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2817 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2818 if (wparam == VK_CLEAR) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2819 return (!extended ? VK_NUMPAD_CLEAR : wparam); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2820 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2821 return wparam; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2822 } |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2823 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2824 /* Main message dispatch loop. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2825 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2826 DWORD |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2827 win_msg_worker (dw) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2828 DWORD dw; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2829 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2830 MSG msg; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2831 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2832 /* Ensure our message queue is created */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2833 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2834 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2835 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2836 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2837 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2838 while (GetMessage (&msg, NULL, 0, 0)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2839 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2840 if (msg.hwnd == NULL) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2841 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2842 switch (msg.message) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2843 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2844 case WM_TIMER: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2845 if (saved_mouse_msg.msg.hwnd) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2846 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2847 Win32Msg wmsg = saved_mouse_msg; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2848 my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2849 wmsg.msg.wParam, wmsg.msg.lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2850 saved_mouse_msg.msg.hwnd = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2851 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2852 timer_id = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2853 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2854 case WM_EMACS_CREATEWINDOW: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2855 win32_createwindow ((struct frame *) msg.wParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2856 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2857 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2858 case WM_EMACS_CREATESCROLLBAR: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2859 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2860 HWND hwnd = win32_createscrollbar ((struct frame *) msg.wParam, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2861 (struct scroll_bar *) msg.lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2862 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, (WPARAM)hwnd, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2863 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2864 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2865 case WM_EMACS_KILL: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2866 return (0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2867 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2868 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2869 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2870 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2871 DispatchMessage (&msg); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2872 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2873 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2874 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2875 return (0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2876 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2877 |
13434 | 2878 /* Main window procedure */ |
2879 | |
2880 extern char *lispy_function_keys[]; | |
2881 | |
2882 LRESULT CALLBACK | |
2883 win32_wnd_proc (hwnd, msg, wParam, lParam) | |
2884 HWND hwnd; | |
2885 UINT msg; | |
2886 WPARAM wParam; | |
2887 LPARAM lParam; | |
2888 { | |
2889 struct frame *f; | |
2890 LRESULT ret = 1; | |
2891 struct win32_display_info *dpyinfo = &one_win32_display_info; | |
2892 Win32Msg wmsg; | |
2893 | |
2894 switch (msg) | |
2895 { | |
2896 case WM_ERASEBKGND: | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2897 enter_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2898 GetUpdateRect (hwnd, &wmsg.rect, FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2899 leave_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2900 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2901 return 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2902 case WM_PALETTECHANGED: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2903 /* ignore our own changes */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2904 if ((HWND)wParam != hwnd) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2905 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2906 /* simply notify main thread it may need to update frames */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2907 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2908 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2909 return 0; |
13434 | 2910 case WM_PAINT: |
2911 { | |
2912 PAINTSTRUCT paintStruct; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2913 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2914 enter_crit (); |
13434 | 2915 BeginPaint (hwnd, &paintStruct); |
2916 wmsg.rect = paintStruct.rcPaint; | |
2917 EndPaint (hwnd, &paintStruct); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2918 leave_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2919 |
13434 | 2920 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
2921 | |
2922 return (0); | |
2923 } | |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2924 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2925 case WM_KEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2926 case WM_SYSKEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2927 record_keyup (wParam, lParam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2928 goto dflt; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2929 |
13434 | 2930 case WM_KEYDOWN: |
2931 case WM_SYSKEYDOWN: | |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2932 record_keydown (wParam, lParam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2933 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2934 wParam = map_keypad_keys (wParam, lParam); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2935 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2936 switch (wParam) { |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2937 case VK_LWIN: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2938 case VK_RWIN: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2939 case VK_APPS: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2940 /* More support for these keys will likely be necessary. */ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2941 if (!NILP (Vwin32_pass_optional_keys_to_system)) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2942 goto dflt; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2943 break; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2944 case VK_MENU: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2945 if (NILP (Vwin32_pass_alt_to_system)) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2946 return 0; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2947 else |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2948 goto dflt; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2949 case VK_CONTROL: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2950 case VK_CAPITAL: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2951 case VK_SHIFT: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2952 /* Pass on to Windows. */ |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2953 goto dflt; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2954 default: |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2955 /* If not defined as a function key, change it to a WM_CHAR message. */ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2956 if (lispy_function_keys[wParam] == 0) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2957 msg = WM_CHAR; |
14353 | 2958 break; |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2959 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2960 |
13434 | 2961 /* Fall through */ |
2962 | |
2963 case WM_SYSCHAR: | |
2964 case WM_CHAR: | |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2965 wmsg.dwModifiers = construct_modifiers (wParam, lParam); |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2966 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2967 enter_crit (); |
13434 | 2968 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2969 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2970 /* Detect quit_char and set quit-flag directly. Note that we dow |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2971 this *after* posting the message to ensure the main thread will |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2972 be woken up if blocked in sys_select(). */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2973 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2974 int c = wParam; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2975 if (isalpha (c) && (wmsg.dwModifiers == LEFT_CTRL_PRESSED |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2976 || wmsg.dwModifiers == RIGHT_CTRL_PRESSED)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2977 c = make_ctrl_char (c) & 0377; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2978 if (c == quit_char) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2979 Vquit_flag = Qt; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2980 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2981 leave_crit (); |
13434 | 2982 break; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
2983 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2984 /* Simulate middle mouse button events when left and right buttons |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2985 are used together, but only if user has two button mouse. */ |
13434 | 2986 case WM_LBUTTONDOWN: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2987 case WM_RBUTTONDOWN: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2988 if (XINT (Vwin32_num_mouse_buttons) == 3) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2989 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2990 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2991 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2992 int this = (msg == WM_LBUTTONDOWN) ? LMOUSE : RMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2993 int other = (msg == WM_LBUTTONDOWN) ? RMOUSE : LMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2994 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2995 if (button_state & this) abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2996 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2997 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2998 SetCapture (hwnd); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2999 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3000 button_state |= this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3001 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3002 if (button_state & other) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3003 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3004 if (timer_id) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3005 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3006 KillTimer (NULL, timer_id); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3007 timer_id = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3008 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3009 /* Generate middle mouse event instead. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3010 msg = WM_MBUTTONDOWN; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3011 button_state |= MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3012 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3013 else if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3014 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3015 /* Ignore button event if we've already generated a |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3016 middle mouse down event. This happens if the |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3017 user releases and press one of the two buttons |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3018 after we've faked a middle mouse event. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3019 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3020 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3021 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3022 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3023 /* Flush out saved message. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3024 wmsg = saved_mouse_msg; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3025 my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3026 wmsg.msg.wParam, wmsg.msg.lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3027 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3028 wmsg.dwModifiers = win32_get_modifiers (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3029 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3030 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3031 /* Clear message buffer. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3032 saved_mouse_msg.msg.hwnd = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3033 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3034 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3035 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3036 /* Hold onto message for now. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3037 timer_id = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3038 SetTimer (NULL, 0, XINT (Vwin32_mouse_button_tolerance), NULL); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3039 saved_mouse_msg.msg.hwnd = hwnd; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3040 saved_mouse_msg.msg.message = msg; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3041 saved_mouse_msg.msg.wParam = wParam; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3042 saved_mouse_msg.msg.lParam = lParam; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3043 saved_mouse_msg.msg.time = GetMessageTime (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3044 saved_mouse_msg.dwModifiers = win32_get_modifiers (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3045 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3046 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3047 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3048 |
13434 | 3049 case WM_LBUTTONUP: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3050 case WM_RBUTTONUP: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3051 if (XINT (Vwin32_num_mouse_buttons) == 3) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3052 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3053 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3054 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3055 int this = (msg == WM_LBUTTONUP) ? LMOUSE : RMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3056 int other = (msg == WM_LBUTTONUP) ? RMOUSE : LMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3057 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3058 if ((button_state & this) == 0) abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3059 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3060 button_state &= ~this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3061 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3062 if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3063 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3064 /* Only generate event when second button is released. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3065 if ((button_state & other) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3066 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3067 msg = WM_MBUTTONUP; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3068 button_state &= ~MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3069 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3070 if (button_state) abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3071 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3072 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3073 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3074 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3075 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3076 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3077 /* Flush out saved message if necessary. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3078 if (saved_mouse_msg.msg.hwnd) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3079 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3080 wmsg = saved_mouse_msg; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3081 my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3082 wmsg.msg.wParam, wmsg.msg.lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3083 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3084 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3085 wmsg.dwModifiers = win32_get_modifiers (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3086 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3087 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3088 /* Always clear message buffer and cancel timer. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3089 saved_mouse_msg.msg.hwnd = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3090 KillTimer (NULL, timer_id); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3091 timer_id = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3092 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3093 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3094 ReleaseCapture (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3095 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3096 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3097 |
13434 | 3098 case WM_MBUTTONDOWN: |
3099 case WM_MBUTTONUP: | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3100 handle_plain_button: |
13434 | 3101 { |
3102 BOOL up; | |
3103 | |
3104 if (parse_button (msg, NULL, &up)) | |
3105 { | |
3106 if (up) ReleaseCapture (); | |
3107 else SetCapture (hwnd); | |
3108 } | |
3109 } | |
3110 | |
3111 wmsg.dwModifiers = win32_get_modifiers (); | |
3112 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3113 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3114 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3115 #if 0 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3116 case WM_MOUSEMOVE: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3117 /* Flush out saved message if necessary. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3118 if (saved_mouse_msg.msg.hwnd) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3119 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3120 wmsg = saved_mouse_msg; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3121 my_post_msg (&wmsg, wmsg.msg.hwnd, wmsg.msg.message, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3122 wmsg.msg.wParam, wmsg.msg.lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3123 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3124 wmsg.dwModifiers = win32_get_modifiers (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3125 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3126 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3127 /* Always clear message buffer and cancel timer. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3128 saved_mouse_msg.msg.hwnd = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3129 KillTimer (NULL, timer_id); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3130 timer_id = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3131 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3132 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3133 #endif |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3134 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3135 case WM_SETFOCUS: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3136 reset_modifiers (); |
13434 | 3137 case WM_MOUSEMOVE: |
3138 case WM_MOVE: | |
3139 case WM_SIZE: | |
3140 case WM_KILLFOCUS: | |
3141 case WM_VSCROLL: | |
3142 case WM_SYSCOMMAND: | |
3143 case WM_COMMAND: | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3144 wmsg.dwModifiers = win32_get_modifiers (); |
13434 | 3145 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
3146 goto dflt; | |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3147 |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3148 case WM_CLOSE: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3149 wmsg.dwModifiers = win32_get_modifiers (); |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3150 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3151 return 0; |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3152 |
13434 | 3153 case WM_WINDOWPOSCHANGING: |
3154 { | |
3155 WINDOWPLACEMENT wp; | |
3156 LPWINDOWPOS lppos = (WINDOWPOS *) lParam; | |
14353 | 3157 |
13434 | 3158 GetWindowPlacement (hwnd, &wp); |
3159 | |
3160 if (wp.showCmd != SW_SHOWMINIMIZED && ! (lppos->flags & SWP_NOSIZE)) | |
3161 { | |
3162 RECT rect; | |
3163 int wdiff; | |
3164 int hdiff; | |
3165 DWORD dwXUnits; | |
3166 DWORD dwYUnits; | |
3167 RECT wr; | |
3168 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3169 wp.length = sizeof(wp); |
13434 | 3170 GetWindowRect (hwnd, &wr); |
3171 | |
14353 | 3172 enter_crit (); |
13434 | 3173 |
3174 dwXUnits = GetWindowLong (hwnd, WND_X_UNITS_INDEX); | |
3175 dwYUnits = GetWindowLong (hwnd, WND_Y_UNITS_INDEX); | |
3176 | |
14353 | 3177 leave_crit (); |
13434 | 3178 |
3179 memset (&rect, 0, sizeof (rect)); | |
3180 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE), | |
3181 GetMenu (hwnd) != NULL); | |
3182 | |
3183 /* All windows have an extra pixel so subtract 1 */ | |
3184 | |
3185 wdiff = (lppos->cx - (rect.right - rect.left) - 0) % dwXUnits; | |
3186 hdiff = (lppos->cy - (rect.bottom - rect.top) - 0) % dwYUnits; | |
3187 | |
3188 if (wdiff || hdiff) | |
3189 { | |
3190 /* For right/bottom sizing we can just fix the sizes. | |
3191 However for top/left sizing we will need to fix the X | |
3192 and Y positions as well. */ | |
3193 | |
3194 lppos->cx -= wdiff; | |
3195 lppos->cy -= hdiff; | |
3196 | |
3197 if (wp.showCmd != SW_SHOWMAXIMIZED | |
3198 && ! (lppos->flags & SWP_NOMOVE)) | |
3199 { | |
3200 if (lppos->x != wr.left || lppos->y != wr.top) | |
3201 { | |
3202 lppos->x += wdiff; | |
3203 lppos->y += hdiff; | |
3204 } | |
3205 else | |
3206 { | |
3207 lppos->flags |= SWP_NOMOVE; | |
3208 } | |
3209 } | |
3210 | |
3211 ret = 0; | |
3212 } | |
3213 } | |
3214 } | |
3215 | |
3216 if (ret == 0) return (0); | |
3217 | |
3218 goto dflt; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3219 case WM_EMACS_SHOWWINDOW: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3220 return ShowWindow (hwnd, wParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3221 case WM_EMACS_SETWINDOWPOS: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3222 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3223 Win32WindowPos * pos = (Win32WindowPos *) wParam; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3224 return SetWindowPos (hwnd, pos->hwndAfter, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3225 pos->x, pos->y, pos->cx, pos->cy, pos->flags); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3226 } |
13434 | 3227 case WM_EMACS_DESTROYWINDOW: |
3228 DestroyWindow ((HWND) wParam); | |
3229 break; | |
3230 default: | |
3231 dflt: | |
3232 return DefWindowProc (hwnd, msg, wParam, lParam); | |
3233 } | |
3234 | |
3235 return (1); | |
3236 } | |
3237 | |
3238 void | |
3239 my_create_window (f) | |
3240 struct frame * f; | |
3241 { | |
3242 MSG msg; | |
3243 | |
3244 PostThreadMessage (dwWinThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0); | |
3245 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); | |
3246 } | |
3247 | |
3248 /* Create and set up the win32 window for frame F. */ | |
3249 | |
3250 static void | |
3251 win32_window (f, window_prompting, minibuffer_only) | |
3252 struct frame *f; | |
3253 long window_prompting; | |
3254 int minibuffer_only; | |
3255 { | |
3256 BLOCK_INPUT; | |
3257 | |
3258 /* Use the resource name as the top-level window name | |
3259 for looking up resources. Make a non-Lisp copy | |
3260 for the window manager, so GC relocation won't bother it. | |
3261 | |
3262 Elsewhere we specify the window name for the window manager. */ | |
3263 | |
3264 { | |
3265 char *str = (char *) XSTRING (Vx_resource_name)->data; | |
3266 f->namebuf = (char *) xmalloc (strlen (str) + 1); | |
3267 strcpy (f->namebuf, str); | |
3268 } | |
3269 | |
3270 my_create_window (f); | |
3271 | |
3272 validate_x_resource_name (); | |
3273 | |
3274 /* x_set_name normally ignores requests to set the name if the | |
3275 requested name is the same as the current name. This is the one | |
3276 place where that assumption isn't correct; f->name is set, but | |
3277 the server hasn't been told. */ | |
3278 { | |
3279 Lisp_Object name; | |
3280 int explicit = f->explicit_name; | |
3281 | |
3282 f->explicit_name = 0; | |
3283 name = f->name; | |
3284 f->name = Qnil; | |
3285 x_set_name (f, name, explicit); | |
3286 } | |
3287 | |
3288 UNBLOCK_INPUT; | |
3289 | |
3290 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) | |
3291 initialize_frame_menubar (f); | |
3292 | |
3293 if (FRAME_WIN32_WINDOW (f) == 0) | |
3294 error ("Unable to create window"); | |
3295 } | |
3296 | |
3297 /* Handle the icon stuff for this window. Perhaps later we might | |
3298 want an x_set_icon_position which can be called interactively as | |
3299 well. */ | |
3300 | |
3301 static void | |
3302 x_icon (f, parms) | |
3303 struct frame *f; | |
3304 Lisp_Object parms; | |
3305 { | |
3306 Lisp_Object icon_x, icon_y; | |
3307 | |
3308 /* Set the position of the icon. Note that win95 groups all | |
3309 icons in the tray. */ | |
3310 icon_x = x_get_arg (parms, Qicon_left, 0, 0, number); | |
3311 icon_y = x_get_arg (parms, Qicon_top, 0, 0, number); | |
3312 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) | |
3313 { | |
3314 CHECK_NUMBER (icon_x, 0); | |
3315 CHECK_NUMBER (icon_y, 0); | |
3316 } | |
3317 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | |
3318 error ("Both left and top icon corners of icon must be specified"); | |
3319 | |
3320 BLOCK_INPUT; | |
3321 | |
3322 if (! EQ (icon_x, Qunbound)) | |
3323 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); | |
3324 | |
3325 UNBLOCK_INPUT; | |
3326 } | |
3327 | |
3328 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |
3329 1, 1, 0, | |
3330 "Make a new window, which is called a \"frame\" in Emacs terms.\n\ | |
3331 Returns an Emacs frame object.\n\ | |
3332 ALIST is an alist of frame parameters.\n\ | |
3333 If the parameters specify that the frame should not have a minibuffer,\n\ | |
3334 and do not specify a specific minibuffer window to use,\n\ | |
3335 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\ | |
3336 be shared by the new frame.\n\ | |
3337 \n\ | |
3338 This function is an internal primitive--use `make-frame' instead.") | |
3339 (parms) | |
3340 Lisp_Object parms; | |
3341 { | |
3342 struct frame *f; | |
3343 Lisp_Object frame, tem; | |
3344 Lisp_Object name; | |
3345 int minibuffer_only = 0; | |
3346 long window_prompting = 0; | |
3347 int width, height; | |
3348 int count = specpdl_ptr - specpdl; | |
3349 struct gcpro gcpro1; | |
3350 Lisp_Object display; | |
3351 struct win32_display_info *dpyinfo; | |
3352 Lisp_Object parent; | |
3353 struct kboard *kb; | |
3354 | |
3355 /* Use this general default value to start with | |
3356 until we know if this frame has a specified name. */ | |
3357 Vx_resource_name = Vinvocation_name; | |
3358 | |
3359 display = x_get_arg (parms, Qdisplay, 0, 0, string); | |
3360 if (EQ (display, Qunbound)) | |
3361 display = Qnil; | |
3362 dpyinfo = check_x_display_info (display); | |
3363 #ifdef MULTI_KBOARD | |
3364 kb = dpyinfo->kboard; | |
3365 #else | |
3366 kb = &the_only_kboard; | |
3367 #endif | |
3368 | |
3369 name = x_get_arg (parms, Qname, "title", "Title", string); | |
3370 if (!STRINGP (name) | |
3371 && ! EQ (name, Qunbound) | |
3372 && ! NILP (name)) | |
3373 error ("Invalid frame name--not a string or nil"); | |
3374 | |
3375 if (STRINGP (name)) | |
3376 Vx_resource_name = name; | |
3377 | |
3378 /* See if parent window is specified. */ | |
3379 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number); | |
3380 if (EQ (parent, Qunbound)) | |
3381 parent = Qnil; | |
3382 if (! NILP (parent)) | |
3383 CHECK_NUMBER (parent, 0); | |
3384 | |
3385 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol); | |
3386 if (EQ (tem, Qnone) || NILP (tem)) | |
3387 f = make_frame_without_minibuffer (Qnil, kb, display); | |
3388 else if (EQ (tem, Qonly)) | |
3389 { | |
3390 f = make_minibuffer_frame (); | |
3391 minibuffer_only = 1; | |
3392 } | |
3393 else if (WINDOWP (tem)) | |
3394 f = make_frame_without_minibuffer (tem, kb, display); | |
3395 else | |
3396 f = make_frame (1); | |
3397 | |
3398 /* Note that Windows does support scroll bars. */ | |
3399 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3400 /* By default, make scrollbars the system standard width. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3401 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL); |
13434 | 3402 |
3403 XSETFRAME (frame, f); | |
3404 GCPRO1 (frame); | |
3405 | |
3406 f->output_method = output_win32; | |
3407 f->output_data.win32 = (struct win32_output *) xmalloc (sizeof (struct win32_output)); | |
3408 bzero (f->output_data.win32, sizeof (struct win32_output)); | |
3409 | |
3410 /* FRAME_WIN32_DISPLAY_INFO (f) = dpyinfo; */ | |
3411 #ifdef MULTI_KBOARD | |
3412 FRAME_KBOARD (f) = kb; | |
3413 #endif | |
3414 | |
3415 /* Specify the parent under which to make this window. */ | |
3416 | |
3417 if (!NILP (parent)) | |
3418 { | |
3419 f->output_data.win32->parent_desc = (Window) parent; | |
3420 f->output_data.win32->explicit_parent = 1; | |
3421 } | |
3422 else | |
3423 { | |
3424 f->output_data.win32->parent_desc = FRAME_WIN32_DISPLAY_INFO (f)->root_window; | |
3425 f->output_data.win32->explicit_parent = 0; | |
3426 } | |
3427 | |
3428 /* Note that the frame has no physical cursor right now. */ | |
3429 f->phys_cursor_x = -1; | |
3430 | |
3431 /* Set the name; the functions to which we pass f expect the name to | |
3432 be set. */ | |
3433 if (EQ (name, Qunbound) || NILP (name)) | |
3434 { | |
3435 f->name = build_string (dpyinfo->win32_id_name); | |
3436 f->explicit_name = 0; | |
3437 } | |
3438 else | |
3439 { | |
3440 f->name = name; | |
3441 f->explicit_name = 1; | |
3442 /* use the frame's title when getting resources for this frame. */ | |
3443 specbind (Qx_resource_name, name); | |
3444 } | |
3445 | |
3446 /* Extract the window parameters from the supplied values | |
3447 that are needed to determine window geometry. */ | |
3448 { | |
3449 Lisp_Object font; | |
3450 | |
3451 font = x_get_arg (parms, Qfont, "font", "Font", string); | |
3452 BLOCK_INPUT; | |
3453 /* First, try whatever font the caller has specified. */ | |
3454 if (STRINGP (font)) | |
3455 font = x_new_font (f, XSTRING (font)->data); | |
3456 #if 0 | |
3457 /* Try out a font which we hope has bold and italic variations. */ | |
3458 if (!STRINGP (font)) | |
3459 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); | |
3460 if (! STRINGP (font)) | |
3461 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); | |
3462 if (! STRINGP (font)) | |
3463 /* This was formerly the first thing tried, but it finds too many fonts | |
3464 and takes too long. */ | |
3465 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1"); | |
3466 /* If those didn't work, look for something which will at least work. */ | |
3467 if (! STRINGP (font)) | |
3468 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1"); | |
3469 if (! STRINGP (font)) | |
3470 font = x_new_font (f, "-*-system-medium-r-normal-*-*-200-*-*-c-120-*-*"); | |
3471 #endif | |
3472 if (! STRINGP (font)) | |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3473 font = x_new_font (f, "-*-Fixedsys-*-r-*-*-12-90-*-*-c-*-*-*"); |
13434 | 3474 UNBLOCK_INPUT; |
3475 if (! STRINGP (font)) | |
3476 font = build_string ("-*-system"); | |
3477 | |
3478 x_default_parameter (f, parms, Qfont, font, | |
3479 "font", "Font", string); | |
3480 } | |
3481 | |
3482 x_default_parameter (f, parms, Qborder_width, make_number (2), | |
3483 "borderwidth", "BorderWidth", number); | |
3484 /* This defaults to 2 in order to match xterm. We recognize either | |
3485 internalBorderWidth or internalBorder (which is what xterm calls | |
3486 it). */ | |
3487 if (NILP (Fassq (Qinternal_border_width, parms))) | |
3488 { | |
3489 Lisp_Object value; | |
3490 | |
3491 value = x_get_arg (parms, Qinternal_border_width, | |
3492 "internalBorder", "BorderWidth", number); | |
3493 if (! EQ (value, Qunbound)) | |
3494 parms = Fcons (Fcons (Qinternal_border_width, value), | |
3495 parms); | |
3496 } | |
3497 x_default_parameter (f, parms, Qinternal_border_width, make_number (0), | |
3498 "internalBorderWidth", "BorderWidth", number); | |
3499 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt, | |
3500 "verticalScrollBars", "ScrollBars", boolean); | |
3501 | |
3502 /* Also do the stuff which must be set before the window exists. */ | |
3503 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), | |
3504 "foreground", "Foreground", string); | |
3505 x_default_parameter (f, parms, Qbackground_color, build_string ("white"), | |
3506 "background", "Background", string); | |
3507 x_default_parameter (f, parms, Qmouse_color, build_string ("black"), | |
3508 "pointerColor", "Foreground", string); | |
3509 x_default_parameter (f, parms, Qcursor_color, build_string ("black"), | |
3510 "cursorColor", "Foreground", string); | |
3511 x_default_parameter (f, parms, Qborder_color, build_string ("black"), | |
3512 "borderColor", "BorderColor", string); | |
3513 | |
3514 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), | |
3515 "menuBar", "MenuBar", number); | |
3516 x_default_parameter (f, parms, Qscroll_bar_width, Qnil, | |
3517 "scrollBarWidth", "ScrollBarWidth", number); | |
3518 | |
3519 f->output_data.win32->dwStyle = WS_OVERLAPPEDWINDOW; | |
3520 f->output_data.win32->parent_desc = FRAME_WIN32_DISPLAY_INFO (f)->root_window; | |
3521 window_prompting = x_figure_window_size (f, parms); | |
3522 | |
3523 if (window_prompting & XNegative) | |
3524 { | |
3525 if (window_prompting & YNegative) | |
3526 f->output_data.win32->win_gravity = SouthEastGravity; | |
3527 else | |
3528 f->output_data.win32->win_gravity = NorthEastGravity; | |
3529 } | |
3530 else | |
3531 { | |
3532 if (window_prompting & YNegative) | |
3533 f->output_data.win32->win_gravity = SouthWestGravity; | |
3534 else | |
3535 f->output_data.win32->win_gravity = NorthWestGravity; | |
3536 } | |
3537 | |
3538 f->output_data.win32->size_hint_flags = window_prompting; | |
3539 | |
3540 win32_window (f, window_prompting, minibuffer_only); | |
3541 x_icon (f, parms); | |
3542 init_frame_faces (f); | |
3543 | |
3544 /* We need to do this after creating the window, so that the | |
3545 icon-creation functions can say whose icon they're describing. */ | |
3546 x_default_parameter (f, parms, Qicon_type, Qnil, | |
3547 "bitmapIcon", "BitmapIcon", symbol); | |
3548 | |
3549 x_default_parameter (f, parms, Qauto_raise, Qnil, | |
3550 "autoRaise", "AutoRaiseLower", boolean); | |
3551 x_default_parameter (f, parms, Qauto_lower, Qnil, | |
3552 "autoLower", "AutoRaiseLower", boolean); | |
3553 x_default_parameter (f, parms, Qcursor_type, Qbox, | |
3554 "cursorType", "CursorType", symbol); | |
3555 | |
3556 /* Dimensions, especially f->height, must be done via change_frame_size. | |
3557 Change will not be effected unless different from the current | |
3558 f->height. */ | |
3559 width = f->width; | |
3560 height = f->height; | |
3561 f->height = f->width = 0; | |
3562 change_frame_size (f, height, width, 1, 0); | |
3563 | |
3564 /* Tell the server what size and position, etc, we want, | |
3565 and how badly we want them. */ | |
3566 BLOCK_INPUT; | |
3567 x_wm_set_size_hint (f, window_prompting, 0); | |
3568 UNBLOCK_INPUT; | |
3569 | |
3570 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean); | |
3571 f->no_split = minibuffer_only || EQ (tem, Qt); | |
3572 | |
3573 UNGCPRO; | |
3574 | |
3575 /* It is now ok to make the frame official | |
3576 even if we get an error below. | |
3577 And the frame needs to be on Vframe_list | |
3578 or making it visible won't work. */ | |
3579 Vframe_list = Fcons (frame, Vframe_list); | |
3580 | |
3581 /* Now that the frame is official, it counts as a reference to | |
3582 its display. */ | |
3583 FRAME_WIN32_DISPLAY_INFO (f)->reference_count++; | |
3584 | |
3585 /* Make the window appear on the frame and enable display, | |
3586 unless the caller says not to. However, with explicit parent, | |
3587 Emacs cannot control visibility, so don't try. */ | |
3588 if (! f->output_data.win32->explicit_parent) | |
3589 { | |
3590 Lisp_Object visibility; | |
3591 | |
3592 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol); | |
3593 if (EQ (visibility, Qunbound)) | |
3594 visibility = Qt; | |
3595 | |
3596 if (EQ (visibility, Qicon)) | |
3597 x_iconify_frame (f); | |
3598 else if (! NILP (visibility)) | |
3599 x_make_frame_visible (f); | |
3600 else | |
3601 /* Must have been Qnil. */ | |
3602 ; | |
3603 } | |
3604 | |
3605 return unbind_to (count, frame); | |
3606 } | |
3607 | |
3608 /* FRAME is used only to get a handle on the X display. We don't pass the | |
3609 display info directly because we're called from frame.c, which doesn't | |
3610 know about that structure. */ | |
3611 Lisp_Object | |
3612 x_get_focus_frame (frame) | |
3613 struct frame *frame; | |
3614 { | |
3615 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (frame); | |
3616 Lisp_Object xfocus; | |
3617 if (! dpyinfo->win32_focus_frame) | |
3618 return Qnil; | |
3619 | |
3620 XSETFRAME (xfocus, dpyinfo->win32_focus_frame); | |
3621 return xfocus; | |
3622 } | |
3623 | |
3624 DEFUN ("focus-frame", Ffocus_frame, Sfocus_frame, 1, 1, 0, | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3625 "This function is obsolete, and does nothing.") |
13434 | 3626 (frame) |
3627 Lisp_Object frame; | |
3628 { | |
3629 return Qnil; | |
3630 } | |
3631 | |
3632 DEFUN ("unfocus-frame", Funfocus_frame, Sunfocus_frame, 0, 0, 0, | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3633 "This function is obsolete, and does nothing.") |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3634 () |
13434 | 3635 { |
3636 return Qnil; | |
3637 } | |
3638 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3639 XFontStruct * |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3640 win32_load_font (dpyinfo,name) |
14353 | 3641 struct win32_display_info *dpyinfo; |
3642 char * name; | |
13434 | 3643 { |
3644 XFontStruct * font = NULL; | |
3645 BOOL ok; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3646 |
14353 | 3647 { |
3648 LOGFONT lf; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3649 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3650 if (!name || !x_to_win32_font (name, &lf)) |
14353 | 3651 return (NULL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3652 |
14353 | 3653 font = (XFontStruct *) xmalloc (sizeof (XFontStruct)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3654 |
14353 | 3655 if (!font) return (NULL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3656 |
14353 | 3657 BLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3658 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3659 font->hfont = CreateFontIndirect (&lf); |
13434 | 3660 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3661 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3662 if (font->hfont == NULL) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3663 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3664 ok = FALSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3665 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3666 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3667 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3668 HDC hdc; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3669 HANDLE oldobj; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3670 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3671 hdc = GetDC (dpyinfo->root_window); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3672 oldobj = SelectObject (hdc, font->hfont); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3673 ok = GetTextMetrics (hdc, &font->tm); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3674 SelectObject (hdc, oldobj); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3675 ReleaseDC (dpyinfo->root_window, hdc); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3676 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3677 |
13434 | 3678 UNBLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3679 |
13434 | 3680 if (ok) return (font); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3681 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3682 win32_unload_font (dpyinfo, font); |
13434 | 3683 return (NULL); |
3684 } | |
3685 | |
3686 void | |
3687 win32_unload_font (dpyinfo, font) | |
3688 struct win32_display_info *dpyinfo; | |
3689 XFontStruct * font; | |
3690 { | |
3691 if (font) | |
3692 { | |
14353 | 3693 if (font->hfont) DeleteObject(font->hfont); |
13434 | 3694 xfree (font); |
3695 } | |
3696 } | |
3697 | |
3698 /* The font conversion stuff between x and win32 */ | |
3699 | |
3700 /* X font string is as follows (from faces.el) | |
3701 * (let ((- "[-?]") | |
3702 * (foundry "[^-]+") | |
3703 * (family "[^-]+") | |
3704 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1 | |
3705 * (weight\? "\\([^-]*\\)") ; 1 | |
3706 * (slant "\\([ior]\\)") ; 2 | |
3707 * (slant\? "\\([^-]?\\)") ; 2 | |
3708 * (swidth "\\([^-]*\\)") ; 3 | |
3709 * (adstyle "[^-]*") ; 4 | |
3710 * (pixelsize "[0-9]+") | |
3711 * (pointsize "[0-9][0-9]+") | |
3712 * (resx "[0-9][0-9]+") | |
3713 * (resy "[0-9][0-9]+") | |
3714 * (spacing "[cmp?*]") | |
3715 * (avgwidth "[0-9]+") | |
3716 * (registry "[^-]+") | |
3717 * (encoding "[^-]+") | |
3718 * ) | |
3719 * (setq x-font-regexp | |
3720 * (concat "\\`\\*?[-?*]" | |
3721 * foundry - family - weight\? - slant\? - swidth - adstyle - | |
3722 * pixelsize - pointsize - resx - resy - spacing - registry - | |
3723 * encoding "[-?*]\\*?\\'" | |
3724 * )) | |
3725 * (setq x-font-regexp-head | |
3726 * (concat "\\`[-?*]" foundry - family - weight\? - slant\? | |
3727 * "\\([-*?]\\|\\'\\)")) | |
3728 * (setq x-font-regexp-slant (concat - slant -)) | |
3729 * (setq x-font-regexp-weight (concat - weight -)) | |
3730 * nil) | |
3731 */ | |
3732 | |
3733 #define FONT_START "[-?]" | |
3734 #define FONT_FOUNDRY "[^-]+" | |
3735 #define FONT_FAMILY "\\([^-]+\\)" /* 1 */ | |
3736 #define FONT_WEIGHT "\\(bold\\|demibold\\|medium\\)" /* 2 */ | |
3737 #define FONT_WEIGHT_Q "\\([^-]*\\)" /* 2 */ | |
3738 #define FONT_SLANT "\\([ior]\\)" /* 3 */ | |
3739 #define FONT_SLANT_Q "\\([^-]?\\)" /* 3 */ | |
3740 #define FONT_SWIDTH "\\([^-]*\\)" /* 4 */ | |
3741 #define FONT_ADSTYLE "[^-]*" | |
3742 #define FONT_PIXELSIZE "[^-]*" | |
3743 #define FONT_POINTSIZE "\\([0-9][0-9]+\\|\\*\\)" /* 5 */ | |
3744 #define FONT_RESX "[0-9][0-9]+" | |
3745 #define FONT_RESY "[0-9][0-9]+" | |
3746 #define FONT_SPACING "[cmp?*]" | |
3747 #define FONT_AVGWIDTH "[0-9]+" | |
3748 #define FONT_REGISTRY "[^-]+" | |
3749 #define FONT_ENCODING "[^-]+" | |
3750 | |
3751 #define FONT_REGEXP ("\\`\\*?[-?*]" \ | |
3752 FONT_FOUNDRY "-" \ | |
3753 FONT_FAMILY "-" \ | |
3754 FONT_WEIGHT_Q "-" \ | |
3755 FONT_SLANT_Q "-" \ | |
3756 FONT_SWIDTH "-" \ | |
3757 FONT_ADSTYLE "-" \ | |
3758 FONT_PIXELSIZE "-" \ | |
3759 FONT_POINTSIZE "-" \ | |
3760 "[-?*]\\|\\'") | |
3761 | |
3762 #define FONT_REGEXP_HEAD ("\\`[-?*]" \ | |
3763 FONT_FOUNDRY "-" \ | |
3764 FONT_FAMILY "-" \ | |
3765 FONT_WEIGHT_Q "-" \ | |
3766 FONT_SLANT_Q \ | |
3767 "\\([-*?]\\|\\'\\)") | |
3768 | |
3769 #define FONT_REGEXP_SLANT "-" FONT_SLANT "-" | |
3770 #define FONT_REGEXP_WEIGHT "-" FONT_WEIGHT "-" | |
3771 | |
3772 LONG | |
3773 x_to_win32_weight (lpw) | |
3774 char * lpw; | |
3775 { | |
3776 if (!lpw) return (FW_DONTCARE); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3777 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3778 if (stricmp (lpw,"heavy") == 0) return FW_HEAVY; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3779 else if (stricmp (lpw,"extrabold") == 0) return FW_EXTRABOLD; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3780 else if (stricmp (lpw,"bold") == 0) return FW_BOLD; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3781 else if (stricmp (lpw,"demibold") == 0) return FW_SEMIBOLD; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3782 else if (stricmp (lpw,"medium") == 0) return FW_MEDIUM; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3783 else if (stricmp (lpw,"normal") == 0) return FW_NORMAL; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3784 else if (stricmp (lpw,"light") == 0) return FW_LIGHT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3785 else if (stricmp (lpw,"extralight") == 0) return FW_EXTRALIGHT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3786 else if (stricmp (lpw,"thin") == 0) return FW_THIN; |
13434 | 3787 else |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3788 return FW_DONTCARE; |
13434 | 3789 } |
3790 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3791 |
13434 | 3792 char * |
3793 win32_to_x_weight (fnweight) | |
3794 int fnweight; | |
3795 { | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3796 if (fnweight >= FW_HEAVY) return "heavy"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3797 if (fnweight >= FW_EXTRABOLD) return "extrabold"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3798 if (fnweight >= FW_BOLD) return "bold"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3799 if (fnweight >= FW_SEMIBOLD) return "semibold"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3800 if (fnweight >= FW_MEDIUM) return "medium"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3801 if (fnweight >= FW_NORMAL) return "normal"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3802 if (fnweight >= FW_LIGHT) return "light"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3803 if (fnweight >= FW_EXTRALIGHT) return "extralight"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3804 if (fnweight >= FW_THIN) return "thin"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3805 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3806 return "*"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3807 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3808 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3809 LONG |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3810 x_to_win32_charset (lpcs) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3811 char * lpcs; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3812 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3813 if (!lpcs) return (0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3814 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3815 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3816 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3817 else if (stricmp (lpcs,"iso8859") == 0) return ANSI_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3818 else if (stricmp (lpcs,"oem") == 0) return OEM_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3819 #ifdef UNICODE_CHARSET |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3820 else if (stricmp (lpcs,"unicode") == 0) return UNICODE_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3821 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3822 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3823 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3824 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3825 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3826 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3827 char * |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3828 win32_to_x_charset (fncharset) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3829 int fncharset; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3830 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3831 switch (fncharset) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3832 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3833 case ANSI_CHARSET: return "ansi"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3834 case OEM_CHARSET: return "oem"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3835 case SYMBOL_CHARSET: return "symbol"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3836 #ifdef UNICODE_CHARSET |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3837 case UNICODE_CHARSET: return "unicode"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3838 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3839 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3840 return "*"; |
13434 | 3841 } |
3842 | |
3843 BOOL | |
3844 win32_to_x_font (lplogfont, lpxstr, len) | |
3845 LOGFONT * lplogfont; | |
3846 char * lpxstr; | |
3847 int len; | |
3848 { | |
3849 if (!lpxstr) return (FALSE); | |
3850 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3851 if (lplogfont) |
13434 | 3852 { |
3853 _snprintf (lpxstr, len - 1, | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3854 "-*-%s-%s-%c-*-*-%d-%d-*-*-%c-%d-*-%s-", |
13434 | 3855 lplogfont->lfFaceName, |
3856 win32_to_x_weight (lplogfont->lfWeight), | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3857 lplogfont->lfItalic?'i':'r', |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3858 abs (lplogfont->lfHeight), |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3859 (abs (lplogfont->lfHeight) * 720) / one_win32_display_info.height_in, |
13434 | 3860 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c', |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3861 lplogfont->lfWidth * 10, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3862 win32_to_x_charset (lplogfont->lfCharSet) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3863 ); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3864 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3865 else |
13434 | 3866 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3867 strncpy (lpxstr,"-*-*-*-*-*-*-*-*-*-*-*-*-*-*-", len - 1); |
13434 | 3868 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3869 |
13434 | 3870 lpxstr[len - 1] = 0; /* just to be sure */ |
3871 return (TRUE); | |
3872 } | |
3873 | |
3874 BOOL | |
3875 x_to_win32_font (lpxstr, lplogfont) | |
3876 char * lpxstr; | |
3877 LOGFONT * lplogfont; | |
3878 { | |
3879 if (!lplogfont) return (FALSE); | |
3880 | |
3881 memset (lplogfont, 0, sizeof (*lplogfont)); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3882 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3883 #if 0 |
13434 | 3884 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS; |
3885 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; | |
3886 lplogfont->lfQuality = DEFAULT_QUALITY; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3887 #else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3888 /* go for maximum quality */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3889 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3890 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3891 lplogfont->lfQuality = PROOF_QUALITY; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3892 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3893 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3894 if (!lpxstr) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3895 return FALSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3896 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3897 /* Provide a simple escape mechanism for specifying Windows font names |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3898 * directly -- if font spec does not beginning with '-', assume this |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3899 * format: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3900 * "<font name>[:height in pixels[:width in pixels[:weight]]]" |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3901 */ |
13434 | 3902 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3903 if (*lpxstr == '-') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3904 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3905 int fields; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3906 char name[50], weight[20], slant, pitch, pixels[10], height[10], width[10], remainder[20]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3907 char * encoding; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3908 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3909 fields = sscanf (lpxstr, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3910 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%*[^-]-%c-%9[^-]-%19s", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3911 name, weight, &slant, pixels, height, &pitch, width, remainder); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3912 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3913 if (fields == EOF) return (FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3914 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3915 if (fields > 0 && name[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3916 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3917 strncpy (lplogfont->lfFaceName,name, LF_FACESIZE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3918 lplogfont->lfFaceName[LF_FACESIZE-1] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3919 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3920 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3921 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3922 lplogfont->lfFaceName[0] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3923 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3924 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3925 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3926 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3927 lplogfont->lfWeight = x_to_win32_weight ((fields > 0 ? weight : "")); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3928 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3929 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3930 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3931 if (!NILP (Vwin32_enable_italics)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3932 lplogfont->lfItalic = (fields > 0 && slant == 'i'); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3933 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3934 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3935 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3936 if (fields > 0 && pixels[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3937 lplogfont->lfHeight = atoi (pixels); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3938 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3939 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3940 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3941 if (fields > 0 && lplogfont->lfHeight == 0 && height[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3942 lplogfont->lfHeight = (atoi (height) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3943 * one_win32_display_info.height_in) / 720; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3944 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3945 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3946 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3947 lplogfont->lfPitchAndFamily = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3948 (fields > 0 && pitch == 'p') ? VARIABLE_PITCH : FIXED_PITCH; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3949 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3950 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3951 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3952 if (fields > 0 && width[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3953 lplogfont->lfWidth = atoi (width) / 10; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3954 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3955 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3956 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3957 /* Not all font specs include the registry field, so we allow for an |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3958 optional registry field before the encoding when parsing |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3959 remainder. Also we strip the trailing '-' if present. */ |
14353 | 3960 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3961 int len = strlen (remainder); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3962 if (len > 0 && remainder[len-1] == '-') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3963 remainder[len-1] = 0; |
13434 | 3964 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3965 encoding = remainder; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3966 if (strncmp (encoding, "*-", 2) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3967 encoding += 2; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3968 lplogfont->lfCharSet = x_to_win32_charset (fields > 0 ? encoding : ""); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3969 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3970 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3971 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3972 int fields; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3973 char name[100], height[10], width[10], weight[20]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3974 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3975 fields = sscanf (lpxstr, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3976 "%99[^:]:%9[^:]:%9[^:]:%19s", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3977 name, height, width, weight); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3978 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3979 if (fields == EOF) return (FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3980 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3981 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3982 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3983 strncpy (lplogfont->lfFaceName,name, LF_FACESIZE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3984 lplogfont->lfFaceName[LF_FACESIZE-1] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3985 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3986 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3987 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3988 lplogfont->lfFaceName[0] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3989 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3990 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3991 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3992 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3993 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3994 lplogfont->lfHeight = atoi (height); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3995 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3996 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3997 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3998 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3999 lplogfont->lfWidth = atoi (width); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4000 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4001 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4002 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4003 lplogfont->lfWeight = x_to_win32_weight ((fields > 0 ? weight : "")); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4004 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4005 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4006 /* This makes TrueType fonts work better. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4007 lplogfont->lfHeight = - abs (lplogfont->lfHeight); |
13434 | 4008 |
4009 return (TRUE); | |
4010 } | |
4011 | |
4012 BOOL | |
4013 win32_font_match (lpszfont1, lpszfont2) | |
4014 char * lpszfont1; | |
4015 char * lpszfont2; | |
4016 { | |
4017 char * s1 = lpszfont1, *e1; | |
4018 char * s2 = lpszfont2, *e2; | |
4019 | |
4020 if (s1 == NULL || s2 == NULL) return (FALSE); | |
4021 | |
4022 if (*s1 == '-') s1++; | |
4023 if (*s2 == '-') s2++; | |
4024 | |
4025 while (1) | |
4026 { | |
4027 int len1, len2; | |
4028 | |
4029 e1 = strchr (s1, '-'); | |
4030 e2 = strchr (s2, '-'); | |
4031 | |
4032 if (e1 == NULL || e2 == NULL) return (TRUE); | |
4033 | |
4034 len1 = e1 - s1; | |
4035 len2 = e2 - s2; | |
4036 | |
4037 if (*s1 != '*' && *s2 != '*' | |
4038 && (len1 != len2 || strnicmp (s1, s2, len1) != 0)) | |
4039 return (FALSE); | |
4040 | |
4041 s1 = e1 + 1; | |
4042 s2 = e2 + 1; | |
4043 } | |
4044 } | |
4045 | |
4046 typedef struct enumfont_t | |
4047 { | |
4048 HDC hdc; | |
4049 int numFonts; | |
4050 XFontStruct *size_ref; | |
4051 Lisp_Object *pattern; | |
4052 Lisp_Object *head; | |
4053 Lisp_Object *tail; | |
4054 } enumfont_t; | |
4055 | |
4056 int CALLBACK | |
4057 enum_font_cb2 (lplf, lptm, FontType, lpef) | |
4058 ENUMLOGFONT * lplf; | |
4059 NEWTEXTMETRIC * lptm; | |
4060 int FontType; | |
4061 enumfont_t * lpef; | |
4062 { | |
4063 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline | |
4064 || (lplf->elfLogFont.lfCharSet != ANSI_CHARSET && lplf->elfLogFont.lfCharSet != OEM_CHARSET)) | |
4065 return (1); | |
4066 | |
4067 /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */ | |
4068 { | |
4069 char buf[100]; | |
4070 | |
4071 if (!win32_to_x_font (lplf, buf, 100)) return (0); | |
4072 | |
4073 if (NILP (*(lpef->pattern)) || win32_font_match (buf, XSTRING (*(lpef->pattern))->data)) | |
4074 { | |
4075 *lpef->tail = Fcons (build_string (buf), Qnil); | |
4076 lpef->tail = &XCONS (*lpef->tail)->cdr; | |
4077 lpef->numFonts++; | |
4078 } | |
4079 } | |
4080 | |
4081 return (1); | |
4082 } | |
4083 | |
4084 int CALLBACK | |
4085 enum_font_cb1 (lplf, lptm, FontType, lpef) | |
4086 ENUMLOGFONT * lplf; | |
4087 NEWTEXTMETRIC * lptm; | |
4088 int FontType; | |
4089 enumfont_t * lpef; | |
4090 { | |
4091 return EnumFontFamilies (lpef->hdc, | |
4092 lplf->elfLogFont.lfFaceName, | |
4093 (FONTENUMPROC) enum_font_cb2, | |
4094 (LPARAM) lpef); | |
4095 } | |
4096 | |
4097 | |
4098 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 3, 0, | |
4099 "Return a list of the names of available fonts matching PATTERN.\n\ | |
4100 If optional arguments FACE and FRAME are specified, return only fonts\n\ | |
4101 the same size as FACE on FRAME.\n\ | |
4102 \n\ | |
4103 PATTERN is a string, perhaps with wildcard characters;\n\ | |
4104 the * character matches any substring, and\n\ | |
4105 the ? character matches any single character.\n\ | |
4106 PATTERN is case-insensitive.\n\ | |
4107 FACE is a face name--a symbol.\n\ | |
4108 \n\ | |
4109 The return value is a list of strings, suitable as arguments to\n\ | |
4110 set-face-font.\n\ | |
4111 \n\ | |
4112 Fonts Emacs can't use (i.e. proportional fonts) may or may not be excluded\n\ | |
4113 even if they match PATTERN and FACE.") | |
4114 (pattern, face, frame) | |
4115 Lisp_Object pattern, face, frame; | |
4116 { | |
4117 int num_fonts; | |
4118 char **names; | |
4119 XFontStruct *info; | |
4120 XFontStruct *size_ref; | |
4121 Lisp_Object namelist; | |
4122 Lisp_Object list; | |
4123 FRAME_PTR f; | |
4124 enumfont_t ef; | |
4125 | |
4126 CHECK_STRING (pattern, 0); | |
4127 if (!NILP (face)) | |
4128 CHECK_SYMBOL (face, 1); | |
4129 | |
4130 f = check_x_frame (frame); | |
4131 | |
4132 /* Determine the width standard for comparison with the fonts we find. */ | |
4133 | |
4134 if (NILP (face)) | |
4135 size_ref = 0; | |
4136 else | |
4137 { | |
4138 int face_id; | |
4139 | |
4140 /* Don't die if we get called with a terminal frame. */ | |
4141 if (! FRAME_WIN32_P (f)) | |
4142 error ("non-win32 frame used in `x-list-fonts'"); | |
4143 | |
4144 face_id = face_name_id_number (f, face); | |
4145 | |
4146 if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f) | |
4147 || FRAME_PARAM_FACES (f) [face_id] == 0) | |
4148 size_ref = f->output_data.win32->font; | |
4149 else | |
4150 { | |
4151 size_ref = FRAME_PARAM_FACES (f) [face_id]->font; | |
4152 if (size_ref == (XFontStruct *) (~0)) | |
4153 size_ref = f->output_data.win32->font; | |
4154 } | |
4155 } | |
4156 | |
4157 /* See if we cached the result for this particular query. */ | |
4158 list = Fassoc (pattern, | |
4159 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr); | |
4160 | |
4161 /* We have info in the cache for this PATTERN. */ | |
4162 if (!NILP (list)) | |
4163 { | |
4164 Lisp_Object tem, newlist; | |
4165 | |
4166 /* We have info about this pattern. */ | |
4167 list = XCONS (list)->cdr; | |
4168 | |
4169 if (size_ref == 0) | |
4170 return list; | |
4171 | |
4172 BLOCK_INPUT; | |
4173 | |
4174 /* Filter the cached info and return just the fonts that match FACE. */ | |
4175 newlist = Qnil; | |
4176 for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr) | |
4177 { | |
4178 XFontStruct *thisinfo; | |
4179 | |
4180 thisinfo = win32_load_font (FRAME_WIN32_DISPLAY_INFO (f), XSTRING (XCONS (tem)->car)->data); | |
4181 | |
4182 if (thisinfo && same_size_fonts (thisinfo, size_ref)) | |
4183 newlist = Fcons (XCONS (tem)->car, newlist); | |
4184 | |
4185 win32_unload_font (FRAME_WIN32_DISPLAY_INFO (f), thisinfo); | |
4186 } | |
4187 | |
4188 UNBLOCK_INPUT; | |
4189 | |
4190 return newlist; | |
4191 } | |
4192 | |
4193 BLOCK_INPUT; | |
4194 | |
4195 namelist = Qnil; | |
4196 ef.pattern = &pattern; | |
4197 ef.tail = ef.head = &namelist; | |
4198 ef.numFonts = 0; | |
4199 | |
4200 { | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4201 ef.hdc = GetDC (FRAME_WIN32_WINDOW (f)); |
13434 | 4202 |
4203 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, (LPARAM)&ef); | |
4204 | |
4205 ReleaseDC (FRAME_WIN32_WINDOW (f), ef.hdc); | |
4206 } | |
4207 | |
4208 UNBLOCK_INPUT; | |
4209 | |
4210 if (ef.numFonts) | |
4211 { | |
4212 int i; | |
4213 Lisp_Object cur; | |
4214 | |
4215 /* Make a list of all the fonts we got back. | |
4216 Store that in the font cache for the display. */ | |
4217 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr | |
4218 = Fcons (Fcons (pattern, namelist), | |
4219 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr); | |
4220 | |
4221 /* Make a list of the fonts that have the right width. */ | |
4222 list = Qnil; | |
4223 cur=namelist; | |
4224 for (i = 0; i < ef.numFonts; i++) | |
4225 { | |
4226 int keeper; | |
4227 | |
4228 if (!size_ref) | |
4229 keeper = 1; | |
4230 else | |
4231 { | |
4232 XFontStruct *thisinfo; | |
4233 | |
4234 BLOCK_INPUT; | |
4235 thisinfo = win32_load_font (FRAME_WIN32_DISPLAY_INFO (f), XSTRING (Fcar (cur))->data); | |
4236 | |
4237 keeper = thisinfo && same_size_fonts (thisinfo, size_ref); | |
4238 | |
4239 win32_unload_font (FRAME_WIN32_DISPLAY_INFO (f), thisinfo); | |
4240 | |
4241 UNBLOCK_INPUT; | |
4242 } | |
4243 if (keeper) | |
4244 list = Fcons (build_string (XSTRING (Fcar (cur))->data), list); | |
4245 | |
4246 cur = Fcdr (cur); | |
4247 } | |
4248 list = Fnreverse (list); | |
4249 } | |
4250 | |
4251 return list; | |
4252 } | |
4253 | |
4254 DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, | |
4255 "Return non-nil if color COLOR is supported on frame FRAME.\n\ | |
4256 If FRAME is omitted or nil, use the selected frame.") | |
4257 (color, frame) | |
4258 Lisp_Object color, frame; | |
4259 { | |
4260 COLORREF foo; | |
4261 FRAME_PTR f = check_x_frame (frame); | |
4262 | |
4263 CHECK_STRING (color, 1); | |
4264 | |
4265 if (defined_color (f, XSTRING (color)->data, &foo, 0)) | |
4266 return Qt; | |
4267 else | |
4268 return Qnil; | |
4269 } | |
4270 | |
4271 DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0, | |
4272 "Return a description of the color named COLOR on frame FRAME.\n\ | |
4273 The value is a list of integer RGB values--(RED GREEN BLUE).\n\ | |
4274 These values appear to range from 0 to 65280 or 65535, depending\n\ | |
4275 on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\ | |
4276 If FRAME is omitted or nil, use the selected frame.") | |
4277 (color, frame) | |
4278 Lisp_Object color, frame; | |
4279 { | |
4280 COLORREF foo; | |
4281 FRAME_PTR f = check_x_frame (frame); | |
4282 | |
4283 CHECK_STRING (color, 1); | |
4284 | |
4285 if (defined_color (f, XSTRING (color)->data, &foo, 0)) | |
4286 { | |
4287 Lisp_Object rgb[3]; | |
4288 | |
4289 rgb[0] = make_number (GetRValue (foo)); | |
4290 rgb[1] = make_number (GetGValue (foo)); | |
4291 rgb[2] = make_number (GetBValue (foo)); | |
4292 return Flist (3, rgb); | |
4293 } | |
4294 else | |
4295 return Qnil; | |
4296 } | |
4297 | |
4298 DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0, | |
4299 "Return t if the X display supports color.\n\ | |
4300 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4301 DISPLAY should be either a frame or a display name (a string).\n\ | |
4302 If omitted or nil, that stands for the selected frame's display.") | |
4303 (display) | |
4304 Lisp_Object display; | |
4305 { | |
4306 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4307 | |
4308 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2) | |
4309 return Qnil; | |
4310 | |
4311 return Qt; | |
4312 } | |
4313 | |
4314 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, | |
4315 0, 1, 0, | |
4316 "Return t if the X display supports shades of gray.\n\ | |
4317 Note that color displays do support shades of gray.\n\ | |
4318 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4319 DISPLAY should be either a frame or a display name (a string).\n\ | |
4320 If omitted or nil, that stands for the selected frame's display.") | |
4321 (display) | |
4322 Lisp_Object display; | |
4323 { | |
4324 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4325 | |
4326 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1) | |
4327 return Qnil; | |
4328 | |
4329 return Qt; | |
4330 } | |
4331 | |
4332 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, | |
4333 0, 1, 0, | |
4334 "Returns the width in pixels of the X display DISPLAY.\n\ | |
4335 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4336 DISPLAY should be either a frame or a display name (a string).\n\ | |
4337 If omitted or nil, that stands for the selected frame's display.") | |
4338 (display) | |
4339 Lisp_Object display; | |
4340 { | |
4341 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4342 | |
4343 return make_number (dpyinfo->width); | |
4344 } | |
4345 | |
4346 DEFUN ("x-display-pixel-height", Fx_display_pixel_height, | |
4347 Sx_display_pixel_height, 0, 1, 0, | |
4348 "Returns the height in pixels of the X display DISPLAY.\n\ | |
4349 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4350 DISPLAY should be either a frame or a display name (a string).\n\ | |
4351 If omitted or nil, that stands for the selected frame's display.") | |
4352 (display) | |
4353 Lisp_Object display; | |
4354 { | |
4355 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4356 | |
4357 return make_number (dpyinfo->height); | |
4358 } | |
4359 | |
4360 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, | |
4361 0, 1, 0, | |
4362 "Returns the number of bitplanes of the display DISPLAY.\n\ | |
4363 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4364 DISPLAY should be either a frame or a display name (a string).\n\ | |
4365 If omitted or nil, that stands for the selected frame's display.") | |
4366 (display) | |
4367 Lisp_Object display; | |
4368 { | |
4369 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4370 | |
4371 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits); | |
4372 } | |
4373 | |
4374 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, | |
4375 0, 1, 0, | |
4376 "Returns the number of color cells of the display DISPLAY.\n\ | |
4377 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4378 DISPLAY should be either a frame or a display name (a string).\n\ | |
4379 If omitted or nil, that stands for the selected frame's display.") | |
4380 (display) | |
4381 Lisp_Object display; | |
4382 { | |
4383 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4384 HDC hdc; | |
4385 int cap; | |
4386 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4387 hdc = GetDC (dpyinfo->root_window); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4388 if (dpyinfo->has_palette) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4389 cap = GetDeviceCaps (hdc,SIZEPALETTE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4390 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4391 cap = GetDeviceCaps (hdc,NUMCOLORS); |
13434 | 4392 |
4393 ReleaseDC (dpyinfo->root_window, hdc); | |
4394 | |
4395 return make_number (cap); | |
4396 } | |
4397 | |
4398 DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |
4399 Sx_server_max_request_size, | |
4400 0, 1, 0, | |
4401 "Returns the maximum request size of the server of display DISPLAY.\n\ | |
4402 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4403 DISPLAY should be either a frame or a display name (a string).\n\ | |
4404 If omitted or nil, that stands for the selected frame's display.") | |
4405 (display) | |
4406 Lisp_Object display; | |
4407 { | |
4408 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4409 | |
4410 return make_number (1); | |
4411 } | |
4412 | |
4413 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, | |
4414 "Returns the vendor ID string of the Win32 system (Microsoft).\n\ | |
4415 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4416 DISPLAY should be either a frame or a display name (a string).\n\ | |
4417 If omitted or nil, that stands for the selected frame's display.") | |
4418 (display) | |
4419 Lisp_Object display; | |
4420 { | |
4421 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4422 char *vendor = "Microsoft Corp."; | |
4423 | |
4424 if (! vendor) vendor = ""; | |
4425 return build_string (vendor); | |
4426 } | |
4427 | |
4428 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, | |
4429 "Returns the version numbers of the server of display DISPLAY.\n\ | |
4430 The value is a list of three integers: the major and minor\n\ | |
4431 version numbers, and the vendor-specific release\n\ | |
4432 number. See also the function `x-server-vendor'.\n\n\ | |
4433 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4434 DISPLAY should be either a frame or a display name (a string).\n\ | |
4435 If omitted or nil, that stands for the selected frame's display.") | |
4436 (display) | |
4437 Lisp_Object display; | |
4438 { | |
4439 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4440 | |
4441 return Fcons (make_number (nt_major_version), | |
4442 Fcons (make_number (nt_minor_version), Qnil)); | |
4443 } | |
4444 | |
4445 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, | |
4446 "Returns the number of screens on the server of display DISPLAY.\n\ | |
4447 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4448 DISPLAY should be either a frame or a display name (a string).\n\ | |
4449 If omitted or nil, that stands for the selected frame's display.") | |
4450 (display) | |
4451 Lisp_Object display; | |
4452 { | |
4453 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4454 | |
4455 return make_number (1); | |
4456 } | |
4457 | |
4458 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0, | |
4459 "Returns the height in millimeters of the X display DISPLAY.\n\ | |
4460 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4461 DISPLAY should be either a frame or a display name (a string).\n\ | |
4462 If omitted or nil, that stands for the selected frame's display.") | |
4463 (display) | |
4464 Lisp_Object display; | |
4465 { | |
4466 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4467 HDC hdc; | |
4468 int cap; | |
4469 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4470 hdc = GetDC (dpyinfo->root_window); |
14353 | 4471 |
13434 | 4472 cap = GetDeviceCaps (hdc, VERTSIZE); |
14353 | 4473 |
13434 | 4474 ReleaseDC (dpyinfo->root_window, hdc); |
4475 | |
4476 return make_number (cap); | |
4477 } | |
4478 | |
4479 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, | |
4480 "Returns the width in millimeters of the X display DISPLAY.\n\ | |
4481 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4482 DISPLAY should be either a frame or a display name (a string).\n\ | |
4483 If omitted or nil, that stands for the selected frame's display.") | |
4484 (display) | |
4485 Lisp_Object display; | |
4486 { | |
4487 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4488 | |
4489 HDC hdc; | |
4490 int cap; | |
4491 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4492 hdc = GetDC (dpyinfo->root_window); |
14353 | 4493 |
13434 | 4494 cap = GetDeviceCaps (hdc, HORZSIZE); |
14353 | 4495 |
13434 | 4496 ReleaseDC (dpyinfo->root_window, hdc); |
4497 | |
4498 return make_number (cap); | |
4499 } | |
4500 | |
4501 DEFUN ("x-display-backing-store", Fx_display_backing_store, | |
4502 Sx_display_backing_store, 0, 1, 0, | |
4503 "Returns an indication of whether display DISPLAY does backing store.\n\ | |
4504 The value may be `always', `when-mapped', or `not-useful'.\n\ | |
4505 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4506 DISPLAY should be either a frame or a display name (a string).\n\ | |
4507 If omitted or nil, that stands for the selected frame's display.") | |
4508 (display) | |
4509 Lisp_Object display; | |
4510 { | |
4511 return intern ("not-useful"); | |
4512 } | |
4513 | |
4514 DEFUN ("x-display-visual-class", Fx_display_visual_class, | |
4515 Sx_display_visual_class, 0, 1, 0, | |
4516 "Returns the visual class of the display DISPLAY.\n\ | |
4517 The value is one of the symbols `static-gray', `gray-scale',\n\ | |
4518 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\ | |
4519 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4520 DISPLAY should be either a frame or a display name (a string).\n\ | |
4521 If omitted or nil, that stands for the selected frame's display.") | |
4522 (display) | |
4523 Lisp_Object display; | |
4524 { | |
4525 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4526 | |
4527 #if 0 | |
4528 switch (dpyinfo->visual->class) | |
4529 { | |
4530 case StaticGray: return (intern ("static-gray")); | |
4531 case GrayScale: return (intern ("gray-scale")); | |
4532 case StaticColor: return (intern ("static-color")); | |
4533 case PseudoColor: return (intern ("pseudo-color")); | |
4534 case TrueColor: return (intern ("true-color")); | |
4535 case DirectColor: return (intern ("direct-color")); | |
4536 default: | |
4537 error ("Display has an unknown visual class"); | |
4538 } | |
4539 #endif | |
4540 | |
4541 error ("Display has an unknown visual class"); | |
4542 } | |
4543 | |
4544 DEFUN ("x-display-save-under", Fx_display_save_under, | |
4545 Sx_display_save_under, 0, 1, 0, | |
4546 "Returns t if the display DISPLAY supports the save-under feature.\n\ | |
4547 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4548 DISPLAY should be either a frame or a display name (a string).\n\ | |
4549 If omitted or nil, that stands for the selected frame's display.") | |
4550 (display) | |
4551 Lisp_Object display; | |
4552 { | |
4553 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4554 | |
4555 return Qnil; | |
4556 } | |
4557 | |
4558 int | |
4559 x_pixel_width (f) | |
4560 register struct frame *f; | |
4561 { | |
4562 return PIXEL_WIDTH (f); | |
4563 } | |
4564 | |
4565 int | |
4566 x_pixel_height (f) | |
4567 register struct frame *f; | |
4568 { | |
4569 return PIXEL_HEIGHT (f); | |
4570 } | |
4571 | |
4572 int | |
4573 x_char_width (f) | |
4574 register struct frame *f; | |
4575 { | |
4576 return FONT_WIDTH (f->output_data.win32->font); | |
4577 } | |
4578 | |
4579 int | |
4580 x_char_height (f) | |
4581 register struct frame *f; | |
4582 { | |
4583 return f->output_data.win32->line_height; | |
4584 } | |
4585 | |
4586 int | |
4587 x_screen_planes (frame) | |
4588 Lisp_Object frame; | |
4589 { | |
4590 return (FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_planes * | |
4591 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_cbits); | |
4592 } | |
4593 | |
4594 /* Return the display structure for the display named NAME. | |
4595 Open a new connection if necessary. */ | |
4596 | |
4597 struct win32_display_info * | |
4598 x_display_info_for_name (name) | |
4599 Lisp_Object name; | |
4600 { | |
4601 Lisp_Object names; | |
4602 struct win32_display_info *dpyinfo; | |
4603 | |
4604 CHECK_STRING (name, 0); | |
4605 | |
4606 for (dpyinfo = &one_win32_display_info, names = win32_display_name_list; | |
4607 dpyinfo; | |
4608 dpyinfo = dpyinfo->next, names = XCONS (names)->cdr) | |
4609 { | |
4610 Lisp_Object tem; | |
4611 tem = Fstring_equal (XCONS (XCONS (names)->car)->car, name); | |
4612 if (!NILP (tem)) | |
4613 return dpyinfo; | |
4614 } | |
4615 | |
4616 /* Use this general default value to start with. */ | |
4617 Vx_resource_name = Vinvocation_name; | |
4618 | |
4619 validate_x_resource_name (); | |
4620 | |
4621 dpyinfo = win32_term_init (name, (unsigned char *)0, | |
4622 (char *) XSTRING (Vx_resource_name)->data); | |
4623 | |
4624 if (dpyinfo == 0) | |
4625 error ("Cannot connect to server %s", XSTRING (name)->data); | |
4626 | |
4627 XSETFASTINT (Vwindow_system_version, 3); | |
4628 | |
4629 return dpyinfo; | |
4630 } | |
4631 | |
4632 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, | |
4633 1, 3, 0, "Open a connection to a server.\n\ | |
4634 DISPLAY is the name of the display to connect to.\n\ | |
4635 Optional second arg XRM-STRING is a string of resources in xrdb format.\n\ | |
4636 If the optional third arg MUST-SUCCEED is non-nil,\n\ | |
4637 terminate Emacs if we can't open the connection.") | |
4638 (display, xrm_string, must_succeed) | |
4639 Lisp_Object display, xrm_string, must_succeed; | |
4640 { | |
4641 unsigned int n_planes; | |
4642 unsigned char *xrm_option; | |
4643 struct win32_display_info *dpyinfo; | |
4644 | |
4645 CHECK_STRING (display, 0); | |
4646 if (! NILP (xrm_string)) | |
4647 CHECK_STRING (xrm_string, 1); | |
4648 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4649 /* Allow color mapping to be defined externally; first look in user's |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4650 HOME directory, then in Emacs etc dir for a file called rgb.txt. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4651 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4652 Lisp_Object color_file; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4653 struct gcpro gcpro1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4654 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4655 color_file = build_string("~/rgb.txt"); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4656 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4657 GCPRO1 (color_file); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4658 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4659 if (NILP (Ffile_readable_p (color_file))) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4660 color_file = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4661 Fexpand_file_name (build_string ("rgb.txt"), |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4662 Fsymbol_value (intern ("data-directory"))); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4663 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4664 Vwin32_color_map = Fwin32_load_color_file (color_file); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4665 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4666 UNGCPRO; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4667 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4668 if (NILP (Vwin32_color_map)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4669 Vwin32_color_map = Fwin32_default_color_map (); |
13434 | 4670 |
4671 if (! NILP (xrm_string)) | |
4672 xrm_option = (unsigned char *) XSTRING (xrm_string)->data; | |
4673 else | |
4674 xrm_option = (unsigned char *) 0; | |
4675 | |
4676 /* Use this general default value to start with. */ | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4677 /* First remove .exe suffix from invocation-name - it looks ugly. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4678 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4679 char basename[ MAX_PATH ], *str; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4680 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4681 strcpy (basename, XSTRING (Vinvocation_name)->data); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4682 str = strrchr (basename, '.'); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4683 if (str) *str = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4684 Vinvocation_name = build_string (basename); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4685 } |
13434 | 4686 Vx_resource_name = Vinvocation_name; |
4687 | |
4688 validate_x_resource_name (); | |
4689 | |
4690 /* This is what opens the connection and sets x_current_display. | |
4691 This also initializes many symbols, such as those used for input. */ | |
4692 dpyinfo = win32_term_init (display, xrm_option, | |
4693 (char *) XSTRING (Vx_resource_name)->data); | |
4694 | |
4695 if (dpyinfo == 0) | |
4696 { | |
4697 if (!NILP (must_succeed)) | |
14353 | 4698 fatal ("Cannot connect to server %s.\n", |
4699 XSTRING (display)->data); | |
13434 | 4700 else |
4701 error ("Cannot connect to server %s", XSTRING (display)->data); | |
4702 } | |
4703 | |
4704 XSETFASTINT (Vwindow_system_version, 3); | |
4705 return Qnil; | |
4706 } | |
4707 | |
4708 DEFUN ("x-close-connection", Fx_close_connection, | |
4709 Sx_close_connection, 1, 1, 0, | |
4710 "Close the connection to DISPLAY's server.\n\ | |
4711 For DISPLAY, specify either a frame or a display name (a string).\n\ | |
4712 If DISPLAY is nil, that stands for the selected frame's display.") | |
4713 (display) | |
4714 Lisp_Object display; | |
4715 { | |
4716 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4717 struct win32_display_info *tail; | |
4718 int i; | |
4719 | |
4720 if (dpyinfo->reference_count > 0) | |
4721 error ("Display still has frames on it"); | |
4722 | |
4723 BLOCK_INPUT; | |
4724 /* Free the fonts in the font table. */ | |
4725 for (i = 0; i < dpyinfo->n_fonts; i++) | |
4726 { | |
4727 if (dpyinfo->font_table[i].name) | |
4728 free (dpyinfo->font_table[i].name); | |
4729 /* Don't free the full_name string; | |
4730 it is always shared with something else. */ | |
4731 win32_unload_font (dpyinfo, dpyinfo->font_table[i].font); | |
4732 } | |
4733 x_destroy_all_bitmaps (dpyinfo); | |
4734 | |
4735 x_delete_display (dpyinfo); | |
4736 UNBLOCK_INPUT; | |
4737 | |
4738 return Qnil; | |
4739 } | |
4740 | |
4741 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, | |
4742 "Return the list of display names that Emacs has connections to.") | |
4743 () | |
4744 { | |
4745 Lisp_Object tail, result; | |
4746 | |
4747 result = Qnil; | |
4748 for (tail = win32_display_name_list; ! NILP (tail); tail = XCONS (tail)->cdr) | |
4749 result = Fcons (XCONS (XCONS (tail)->car)->car, result); | |
4750 | |
4751 return result; | |
4752 } | |
4753 | |
4754 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, | |
4755 "If ON is non-nil, report errors as soon as the erring request is made.\n\ | |
4756 If ON is nil, allow buffering of requests.\n\ | |
4757 This is a noop on Win32 systems.\n\ | |
4758 The optional second argument DISPLAY specifies which display to act on.\n\ | |
4759 DISPLAY should be either a frame or a display name (a string).\n\ | |
4760 If DISPLAY is omitted or nil, that stands for the selected frame's display.") | |
4761 (on, display) | |
4762 Lisp_Object display, on; | |
4763 { | |
4764 struct win32_display_info *dpyinfo = check_x_display_info (display); | |
4765 | |
4766 return Qnil; | |
4767 } | |
4768 | |
4769 | |
4770 /* These are the win32 specialized functions */ | |
4771 | |
4772 DEFUN ("win32-select-font", Fwin32_select_font, Swin32_select_font, 0, 1, 0, | |
4773 "This will display the Win32 font dialog and return an X font string corresponding to the selection.") | |
4774 (frame) | |
4775 Lisp_Object frame; | |
4776 { | |
4777 FRAME_PTR f = check_x_frame (frame); | |
4778 CHOOSEFONT cf; | |
4779 LOGFONT lf; | |
4780 char buf[100]; | |
4781 | |
4782 bzero (&cf, sizeof (cf)); | |
4783 | |
4784 cf.lStructSize = sizeof (cf); | |
4785 cf.hwndOwner = FRAME_WIN32_WINDOW (f); | |
4786 cf.Flags = CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_SCREENFONTS; | |
4787 cf.lpLogFont = &lf; | |
4788 | |
4789 if (!ChooseFont (&cf) || !win32_to_x_font (&lf, buf, 100)) | |
14353 | 4790 return Qnil; |
13434 | 4791 |
4792 return build_string (buf); | |
4793 } | |
4794 | |
4795 | |
4796 syms_of_win32fns () | |
4797 { | |
4798 /* The section below is built by the lisp expression at the top of the file, | |
4799 just above where these variables are declared. */ | |
4800 /*&&& init symbols here &&&*/ | |
4801 Qauto_raise = intern ("auto-raise"); | |
4802 staticpro (&Qauto_raise); | |
4803 Qauto_lower = intern ("auto-lower"); | |
4804 staticpro (&Qauto_lower); | |
4805 Qbackground_color = intern ("background-color"); | |
4806 staticpro (&Qbackground_color); | |
4807 Qbar = intern ("bar"); | |
4808 staticpro (&Qbar); | |
4809 Qborder_color = intern ("border-color"); | |
4810 staticpro (&Qborder_color); | |
4811 Qborder_width = intern ("border-width"); | |
4812 staticpro (&Qborder_width); | |
4813 Qbox = intern ("box"); | |
4814 staticpro (&Qbox); | |
4815 Qcursor_color = intern ("cursor-color"); | |
4816 staticpro (&Qcursor_color); | |
4817 Qcursor_type = intern ("cursor-type"); | |
4818 staticpro (&Qcursor_type); | |
4819 Qfont = intern ("font"); | |
4820 staticpro (&Qfont); | |
4821 Qforeground_color = intern ("foreground-color"); | |
4822 staticpro (&Qforeground_color); | |
4823 Qgeometry = intern ("geometry"); | |
4824 staticpro (&Qgeometry); | |
4825 Qicon_left = intern ("icon-left"); | |
4826 staticpro (&Qicon_left); | |
4827 Qicon_top = intern ("icon-top"); | |
4828 staticpro (&Qicon_top); | |
4829 Qicon_type = intern ("icon-type"); | |
4830 staticpro (&Qicon_type); | |
4831 Qicon_name = intern ("icon-name"); | |
4832 staticpro (&Qicon_name); | |
4833 Qinternal_border_width = intern ("internal-border-width"); | |
4834 staticpro (&Qinternal_border_width); | |
4835 Qleft = intern ("left"); | |
4836 staticpro (&Qleft); | |
4837 Qmouse_color = intern ("mouse-color"); | |
4838 staticpro (&Qmouse_color); | |
4839 Qnone = intern ("none"); | |
4840 staticpro (&Qnone); | |
4841 Qparent_id = intern ("parent-id"); | |
4842 staticpro (&Qparent_id); | |
4843 Qscroll_bar_width = intern ("scroll-bar-width"); | |
4844 staticpro (&Qscroll_bar_width); | |
4845 Qsuppress_icon = intern ("suppress-icon"); | |
4846 staticpro (&Qsuppress_icon); | |
4847 Qtop = intern ("top"); | |
4848 staticpro (&Qtop); | |
4849 Qundefined_color = intern ("undefined-color"); | |
4850 staticpro (&Qundefined_color); | |
4851 Qvertical_scroll_bars = intern ("vertical-scroll-bars"); | |
4852 staticpro (&Qvertical_scroll_bars); | |
4853 Qvisibility = intern ("visibility"); | |
4854 staticpro (&Qvisibility); | |
4855 Qwindow_id = intern ("window-id"); | |
4856 staticpro (&Qwindow_id); | |
4857 Qx_frame_parameter = intern ("x-frame-parameter"); | |
4858 staticpro (&Qx_frame_parameter); | |
4859 Qx_resource_name = intern ("x-resource-name"); | |
4860 staticpro (&Qx_resource_name); | |
4861 Quser_position = intern ("user-position"); | |
4862 staticpro (&Quser_position); | |
4863 Quser_size = intern ("user-size"); | |
4864 staticpro (&Quser_size); | |
4865 Qdisplay = intern ("display"); | |
4866 staticpro (&Qdisplay); | |
4867 /* This is the end of symbol initialization. */ | |
4868 | |
4869 Fput (Qundefined_color, Qerror_conditions, | |
4870 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | |
4871 Fput (Qundefined_color, Qerror_message, | |
4872 build_string ("Undefined color")); | |
4873 | |
4874 DEFVAR_LISP ("win32-color-map", &Vwin32_color_map, | |
4875 "A array of color name mappings for windows."); | |
4876 Vwin32_color_map = Qnil; | |
4877 | |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4878 DEFVAR_LISP ("win32-pass-alt-to-system", &Vwin32_pass_alt_to_system, |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4879 "Non-nil if alt key presses are passed on to Windows.\n\ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4880 When non-nil, for example, alt pressed and released and then space will\n\ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4881 open the System menu. When nil, Emacs silently swallows alt key events."); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4882 Vwin32_pass_alt_to_system = Qnil; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4883 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4884 DEFVAR_LISP ("win32-pass-optional-keys-to-system", |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4885 &Vwin32_pass_optional_keys_to_system, |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4886 "Non-nil if the 'optional' keys (left window, right window,\n\ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4887 and application keys) are passed on to Windows."); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4888 Vwin32_pass_optional_keys_to_system = Qnil; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4889 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4890 DEFVAR_LISP ("win32-enable-italics", &Vwin32_enable_italics, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4891 "Non-nil enables selection of artificially italicized fonts."); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4892 Vwin32_enable_italics = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4893 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4894 DEFVAR_LISP ("win32-enable-palette", &Vwin32_enable_palette, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4895 "Non-nil enables Windows palette management to map colors exactly."); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4896 Vwin32_enable_palette = Qt; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4897 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4898 DEFVAR_INT ("win32-mouse-button-tolerance", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4899 &Vwin32_mouse_button_tolerance, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4900 "Analogue of double click interval for faking middle mouse events.\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4901 The value is the minimum time in milliseconds that must elapse between\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4902 left/right button down events before they are considered distinct events.\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4903 If both mouse buttons are depressed within this interval, a middle mouse\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4904 button down event is generated instead."); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4905 XSETINT (Vwin32_mouse_button_tolerance, GetDoubleClickTime () / 2); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4906 |
13434 | 4907 init_x_parm_symbols (); |
4908 | |
4909 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path, | |
4910 "List of directories to search for bitmap files for win32."); | |
4911 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH"); | |
4912 | |
4913 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape, | |
4914 "The shape of the pointer when over text.\n\ | |
4915 Changing the value does not affect existing frames\n\ | |
4916 unless you set the mouse color."); | |
4917 Vx_pointer_shape = Qnil; | |
4918 | |
4919 DEFVAR_LISP ("x-resource-name", &Vx_resource_name, | |
4920 "The name Emacs uses to look up resources; for internal use only.\n\ | |
4921 `x-get-resource' uses this as the first component of the instance name\n\ | |
4922 when requesting resource values.\n\ | |
4923 Emacs initially sets `x-resource-name' to the name under which Emacs\n\ | |
4924 was invoked, or to the value specified with the `-name' or `-rn'\n\ | |
4925 switches, if present."); | |
4926 Vx_resource_name = Qnil; | |
4927 | |
4928 Vx_nontext_pointer_shape = Qnil; | |
4929 | |
4930 Vx_mode_pointer_shape = Qnil; | |
4931 | |
4932 DEFVAR_INT ("x-sensitive-text-pointer-shape", | |
4933 &Vx_sensitive_text_pointer_shape, | |
4934 "The shape of the pointer when over mouse-sensitive text.\n\ | |
4935 This variable takes effect when you create a new frame\n\ | |
4936 or when you set the mouse color."); | |
4937 Vx_sensitive_text_pointer_shape = Qnil; | |
4938 | |
4939 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, | |
4940 "A string indicating the foreground color of the cursor box."); | |
4941 Vx_cursor_fore_pixel = Qnil; | |
4942 | |
4943 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, | |
4944 "Non-nil if no window manager is in use.\n\ | |
4945 Emacs doesn't try to figure this out; this is always nil\n\ | |
4946 unless you set it to something else."); | |
4947 /* We don't have any way to find this out, so set it to nil | |
4948 and maybe the user would like to set it to t. */ | |
4949 Vx_no_window_manager = Qnil; | |
4950 | |
4951 defsubr (&Sx_get_resource); | |
4952 defsubr (&Sx_list_fonts); | |
4953 defsubr (&Sx_display_color_p); | |
4954 defsubr (&Sx_display_grayscale_p); | |
4955 defsubr (&Sx_color_defined_p); | |
4956 defsubr (&Sx_color_values); | |
4957 defsubr (&Sx_server_max_request_size); | |
4958 defsubr (&Sx_server_vendor); | |
4959 defsubr (&Sx_server_version); | |
4960 defsubr (&Sx_display_pixel_width); | |
4961 defsubr (&Sx_display_pixel_height); | |
4962 defsubr (&Sx_display_mm_width); | |
4963 defsubr (&Sx_display_mm_height); | |
4964 defsubr (&Sx_display_screens); | |
4965 defsubr (&Sx_display_planes); | |
4966 defsubr (&Sx_display_color_cells); | |
4967 defsubr (&Sx_display_visual_class); | |
4968 defsubr (&Sx_display_backing_store); | |
4969 defsubr (&Sx_display_save_under); | |
4970 defsubr (&Sx_parse_geometry); | |
4971 defsubr (&Sx_create_frame); | |
4972 defsubr (&Sfocus_frame); | |
4973 defsubr (&Sunfocus_frame); | |
4974 defsubr (&Sx_open_connection); | |
4975 defsubr (&Sx_close_connection); | |
4976 defsubr (&Sx_display_list); | |
4977 defsubr (&Sx_synchronize); | |
4978 | |
4979 /* Win32 specific functions */ | |
4980 | |
4981 defsubr (&Swin32_select_font); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4982 defsubr (&Swin32_define_rgb_color); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4983 defsubr (&Swin32_default_color_map); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4984 defsubr (&Swin32_load_color_file); |
13434 | 4985 } |
4986 | |
4987 #undef abort | |
4988 | |
4989 void | |
4990 win32_abort() | |
4991 { | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4992 int button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4993 button = MessageBox (NULL, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4994 "A fatal error has occurred!\n\n" |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4995 "Select Abort to exit, Retry to debug, Ignore to continue", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4996 "Emacs Abort Dialog", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4997 MB_ICONEXCLAMATION | MB_TASKMODAL |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4998 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4999 switch (button) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5000 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5001 case IDRETRY: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5002 DebugBreak (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5003 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5004 case IDIGNORE: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5005 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5006 case IDABORT: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5007 default: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5008 abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5009 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5010 } |
13434 | 5011 } |
15148
220145cf7546
(continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents:
15147
diff
changeset
|
5012 |