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