1 /* Graphical user interface functions for Mac OS.
2 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
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)
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.
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
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* Contributed by Andrew Choi (akochoi@mac.com). */
37 #include "dispextern.h"
39 #include "intervals.h"
41 #include "blockinput.h"
43 #include "termhooks.h"
48 /* #include "bitmaps/gray.xbm" */
51 static unsigned char gray_bits
[] = {
54 /*#include <commdlg.h>
55 #include <shellapi.h>*/
57 #include <sys/types.h>
67 #include <QuickTime/QuickTime.h>
68 #else /* not MAC_OSX */
71 #include <TextUtils.h>
72 #endif /* not MAC_OSX */
74 /*extern void free_frame_menubar ();
75 extern double atof ();
76 extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state);
77 extern int quit_char;*/
79 extern char *lispy_function_keys
[];
81 /* The gray bitmap `bitmaps/gray'. This is done because macterm.c uses
82 it, and including `bitmaps/gray' more than once is a problem when
83 config.h defines `static' as an empty replacement string. */
85 int gray_bitmap_width
= gray_width
;
86 int gray_bitmap_height
= gray_height
;
87 unsigned char *gray_bitmap_bits
= gray_bits
;
89 /* Non-zero means we're allowed to display an hourglass cursor. */
91 int display_hourglass_p
;
93 /* The background and shape of the mouse pointer, and shape when not
94 over text or in the modeline. */
96 Lisp_Object Vx_pointer_shape
, Vx_nontext_pointer_shape
, Vx_mode_pointer_shape
;
97 Lisp_Object Vx_hourglass_pointer_shape
;
99 /* The shape when over mouse-sensitive text. */
101 Lisp_Object Vx_sensitive_text_pointer_shape
;
103 /* If non-nil, the pointer shape to indicate that windows can be
104 dragged horizontally. */
106 Lisp_Object Vx_window_horizontal_drag_shape
;
108 /* Color of chars displayed in cursor box. */
110 Lisp_Object Vx_cursor_fore_pixel
;
112 /* Nonzero if using Windows. */
114 static int mac_in_use
;
116 /* Non nil if no window manager is in use. */
118 Lisp_Object Vx_no_window_manager
;
120 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */
122 Lisp_Object Vx_pixel_size_width_font_regexp
;
124 /* Evaluate this expression to rebuild the section of syms_of_macfns
125 that initializes and staticpros the symbols declared below. Note
126 that Emacs 18 has a bug that keeps C-x C-e from being able to
127 evaluate this expression.
130 ;; Accumulate a list of the symbols we want to initialize from the
131 ;; declarations at the top of the file.
132 (goto-char (point-min))
133 (search-forward "/\*&&& symbols declared here &&&*\/\n")
135 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
137 (cons (buffer-substring (match-beginning 1) (match-end 1))
140 (setq symbol-list (nreverse symbol-list))
141 ;; Delete the section of syms_of_... where we initialize the symbols.
142 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
143 (let ((start (point)))
144 (while (looking-at "^ Q")
146 (kill-region start (point)))
147 ;; Write a new symbol initialization section.
149 (insert (format " %s = intern (\"" (car symbol-list)))
150 (let ((start (point)))
151 (insert (substring (car symbol-list) 1))
152 (subst-char-in-region start (point) ?_ ?-))
153 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
154 (setq symbol-list (cdr symbol-list)))))
158 /*&&& symbols declared here &&&*/
160 Lisp_Object Qsuppress_icon
;
161 Lisp_Object Qundefined_color
;
162 Lisp_Object Qcancel_timer
;
168 Lisp_Object Qcontrol
;
171 extern Lisp_Object Vwindow_system_version
;
173 extern int mac_initialized
;
176 /* compare two strings ignoring case */
179 stricmp (const char *s
, const char *t
)
181 for ( ; tolower (*s
) == tolower (*t
); s
++, t
++)
184 return tolower (*s
) - tolower (*t
);
187 /* compare two strings up to n characters, ignoring case */
190 strnicmp (const char *s
, const char *t
, unsigned int n
)
192 for ( ; n
-- > 0 && tolower (*s
) == tolower (*t
); s
++, t
++)
195 return n
== 0 ? 0 : tolower (*s
) - tolower (*t
);
199 /* Error if we are not running on Mac OS. */
205 error ("Mac OS not in use or not initialized");
208 /* Nonzero if we can use mouse menus.
209 You should not call this unless HAVE_MENUS is defined. */
217 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame
218 and checking validity for Mac. */
221 check_x_frame (frame
)
227 frame
= selected_frame
;
228 CHECK_LIVE_FRAME (frame
);
230 if (! FRAME_MAC_P (f
))
231 error ("non-mac frame used");
235 /* Let the user specify a display with a frame.
236 nil stands for the selected frame--or, if that is not a mac frame,
237 the first display on the list. */
239 struct mac_display_info
*
240 check_x_display_info (frame
)
243 if (!mac_initialized
)
251 struct frame
*sf
= XFRAME (selected_frame
);
253 if (FRAME_MAC_P (sf
) && FRAME_LIVE_P (sf
))
254 return FRAME_MAC_DISPLAY_INFO (sf
);
256 return &one_mac_display_info
;
258 else if (STRINGP (frame
))
259 return x_display_info_for_name (frame
);
264 CHECK_LIVE_FRAME (frame
);
266 if (! FRAME_MAC_P (f
))
267 error ("non-mac frame used");
268 return FRAME_MAC_DISPLAY_INFO (f
);
272 /* Return the Emacs frame-object corresponding to a mac window.
273 It could be the frame's main window or an icon window. */
275 /* This function can be called during GC, so use GC_xxx type test macros. */
278 x_window_to_frame (dpyinfo
, wdesc
)
279 struct mac_display_info
*dpyinfo
;
282 Lisp_Object tail
, frame
;
285 for (tail
= Vframe_list
; GC_CONSP (tail
); tail
= XCDR (tail
))
288 if (!GC_FRAMEP (frame
))
291 if (!FRAME_W32_P (f
) || FRAME_MAC_DISPLAY_INFO (f
) != dpyinfo
)
293 /*if (f->output_data.w32->hourglass_window == wdesc)
296 /* MAC_TODO: Check tooltips when supported. */
297 if (FRAME_MAC_WINDOW (f
) == wdesc
)
304 static Lisp_Object unwind_create_frame
P_ ((Lisp_Object
));
306 void x_set_foreground_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
307 void x_set_background_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
308 void x_set_mouse_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
309 void x_set_cursor_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
310 void x_set_border_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
311 void x_set_cursor_type
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
312 void x_set_icon_type
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
313 void x_set_icon_name
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
314 void x_explicitly_set_name
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
315 void x_set_menu_bar_lines
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
316 void x_set_title
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
317 void x_set_tool_bar_lines
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
318 void x_set_scroll_bar_foreground
P_ ((struct frame
*, Lisp_Object
,
320 void x_set_scroll_bar_background
P_ ((struct frame
*, Lisp_Object
,
322 static Lisp_Object x_default_scroll_bar_color_parameter
P_ ((struct frame
*,
327 /* Store the screen positions of frame F into XPTR and YPTR.
328 These are the positions of the containing window manager window,
329 not Emacs's own window. */
332 x_real_positions (f
, xptr
, yptr
)
339 #ifdef TARGET_API_MAC_CARBON
343 GetWindowPortBounds (f
->output_data
.mac
->mWP
, &r
);
344 SetPt (&pt
, r
.left
, r
.top
);
346 #else /* not TARGET_API_MAC_CARBON */
348 f
->output_data
.mac
->mWP
->portRect
.left
,
349 f
->output_data
.mac
->mWP
->portRect
.top
);
350 #endif /* not TARGET_API_MAC_CARBON */
355 /* MAC has no frame pixel diff. */
356 f
->x_pixels_diff
= 0;
357 f
->y_pixels_diff
= 0;
364 /* The default colors for the Mac color map */
365 typedef struct colormap_t
371 colormap_t mac_color_map
[] =
373 { RGB_TO_ULONG(255, 250, 250), "snow" },
374 { RGB_TO_ULONG(248, 248, 255), "ghost white" },
375 { RGB_TO_ULONG(248, 248, 255), "GhostWhite" },
376 { RGB_TO_ULONG(245, 245, 245), "white smoke" },
377 { RGB_TO_ULONG(245, 245, 245), "WhiteSmoke" },
378 { RGB_TO_ULONG(220, 220, 220), "gainsboro" },
379 { RGB_TO_ULONG(255, 250, 240), "floral white" },
380 { RGB_TO_ULONG(255, 250, 240), "FloralWhite" },
381 { RGB_TO_ULONG(253, 245, 230), "old lace" },
382 { RGB_TO_ULONG(253, 245, 230), "OldLace" },
383 { RGB_TO_ULONG(250, 240, 230), "linen" },
384 { RGB_TO_ULONG(250, 235, 215), "antique white" },
385 { RGB_TO_ULONG(250, 235, 215), "AntiqueWhite" },
386 { RGB_TO_ULONG(255, 239, 213), "papaya whip" },
387 { RGB_TO_ULONG(255, 239, 213), "PapayaWhip" },
388 { RGB_TO_ULONG(255, 235, 205), "blanched almond" },
389 { RGB_TO_ULONG(255, 235, 205), "BlanchedAlmond" },
390 { RGB_TO_ULONG(255, 228, 196), "bisque" },
391 { RGB_TO_ULONG(255, 218, 185), "peach puff" },
392 { RGB_TO_ULONG(255, 218, 185), "PeachPuff" },
393 { RGB_TO_ULONG(255, 222, 173), "navajo white" },
394 { RGB_TO_ULONG(255, 222, 173), "NavajoWhite" },
395 { RGB_TO_ULONG(255, 228, 181), "moccasin" },
396 { RGB_TO_ULONG(255, 248, 220), "cornsilk" },
397 { RGB_TO_ULONG(255, 255, 240), "ivory" },
398 { RGB_TO_ULONG(255, 250, 205), "lemon chiffon" },
399 { RGB_TO_ULONG(255, 250, 205), "LemonChiffon" },
400 { RGB_TO_ULONG(255, 245, 238), "seashell" },
401 { RGB_TO_ULONG(240, 255, 240), "honeydew" },
402 { RGB_TO_ULONG(245, 255, 250), "mint cream" },
403 { RGB_TO_ULONG(245, 255, 250), "MintCream" },
404 { RGB_TO_ULONG(240, 255, 255), "azure" },
405 { RGB_TO_ULONG(240, 248, 255), "alice blue" },
406 { RGB_TO_ULONG(240, 248, 255), "AliceBlue" },
407 { RGB_TO_ULONG(230, 230, 250), "lavender" },
408 { RGB_TO_ULONG(255, 240, 245), "lavender blush" },
409 { RGB_TO_ULONG(255, 240, 245), "LavenderBlush" },
410 { RGB_TO_ULONG(255, 228, 225), "misty rose" },
411 { RGB_TO_ULONG(255, 228, 225), "MistyRose" },
412 { RGB_TO_ULONG(255, 255, 255), "white" },
413 { RGB_TO_ULONG(0 , 0 , 0 ), "black" },
414 { RGB_TO_ULONG(47 , 79 , 79 ), "dark slate gray" },
415 { RGB_TO_ULONG(47 , 79 , 79 ), "DarkSlateGray" },
416 { RGB_TO_ULONG(47 , 79 , 79 ), "dark slate grey" },
417 { RGB_TO_ULONG(47 , 79 , 79 ), "DarkSlateGrey" },
418 { RGB_TO_ULONG(105, 105, 105), "dim gray" },
419 { RGB_TO_ULONG(105, 105, 105), "DimGray" },
420 { RGB_TO_ULONG(105, 105, 105), "dim grey" },
421 { RGB_TO_ULONG(105, 105, 105), "DimGrey" },
422 { RGB_TO_ULONG(112, 128, 144), "slate gray" },
423 { RGB_TO_ULONG(112, 128, 144), "SlateGray" },
424 { RGB_TO_ULONG(112, 128, 144), "slate grey" },
425 { RGB_TO_ULONG(112, 128, 144), "SlateGrey" },
426 { RGB_TO_ULONG(119, 136, 153), "light slate gray" },
427 { RGB_TO_ULONG(119, 136, 153), "LightSlateGray" },
428 { RGB_TO_ULONG(119, 136, 153), "light slate grey" },
429 { RGB_TO_ULONG(119, 136, 153), "LightSlateGrey" },
430 { RGB_TO_ULONG(190, 190, 190), "gray" },
431 { RGB_TO_ULONG(190, 190, 190), "grey" },
432 { RGB_TO_ULONG(211, 211, 211), "light grey" },
433 { RGB_TO_ULONG(211, 211, 211), "LightGrey" },
434 { RGB_TO_ULONG(211, 211, 211), "light gray" },
435 { RGB_TO_ULONG(211, 211, 211), "LightGray" },
436 { RGB_TO_ULONG(25 , 25 , 112), "midnight blue" },
437 { RGB_TO_ULONG(25 , 25 , 112), "MidnightBlue" },
438 { RGB_TO_ULONG(0 , 0 , 128), "navy" },
439 { RGB_TO_ULONG(0 , 0 , 128), "navy blue" },
440 { RGB_TO_ULONG(0 , 0 , 128), "NavyBlue" },
441 { RGB_TO_ULONG(100, 149, 237), "cornflower blue" },
442 { RGB_TO_ULONG(100, 149, 237), "CornflowerBlue" },
443 { RGB_TO_ULONG(72 , 61 , 139), "dark slate blue" },
444 { RGB_TO_ULONG(72 , 61 , 139), "DarkSlateBlue" },
445 { RGB_TO_ULONG(106, 90 , 205), "slate blue" },
446 { RGB_TO_ULONG(106, 90 , 205), "SlateBlue" },
447 { RGB_TO_ULONG(123, 104, 238), "medium slate blue" },
448 { RGB_TO_ULONG(123, 104, 238), "MediumSlateBlue" },
449 { RGB_TO_ULONG(132, 112, 255), "light slate blue" },
450 { RGB_TO_ULONG(132, 112, 255), "LightSlateBlue" },
451 { RGB_TO_ULONG(0 , 0 , 205), "medium blue" },
452 { RGB_TO_ULONG(0 , 0 , 205), "MediumBlue" },
453 { RGB_TO_ULONG(65 , 105, 225), "royal blue" },
454 { RGB_TO_ULONG(65 , 105, 225), "RoyalBlue" },
455 { RGB_TO_ULONG(0 , 0 , 255), "blue" },
456 { RGB_TO_ULONG(30 , 144, 255), "dodger blue" },
457 { RGB_TO_ULONG(30 , 144, 255), "DodgerBlue" },
458 { RGB_TO_ULONG(0 , 191, 255), "deep sky blue" },
459 { RGB_TO_ULONG(0 , 191, 255), "DeepSkyBlue" },
460 { RGB_TO_ULONG(135, 206, 235), "sky blue" },
461 { RGB_TO_ULONG(135, 206, 235), "SkyBlue" },
462 { RGB_TO_ULONG(135, 206, 250), "light sky blue" },
463 { RGB_TO_ULONG(135, 206, 250), "LightSkyBlue" },
464 { RGB_TO_ULONG(70 , 130, 180), "steel blue" },
465 { RGB_TO_ULONG(70 , 130, 180), "SteelBlue" },
466 { RGB_TO_ULONG(176, 196, 222), "light steel blue" },
467 { RGB_TO_ULONG(176, 196, 222), "LightSteelBlue" },
468 { RGB_TO_ULONG(173, 216, 230), "light blue" },
469 { RGB_TO_ULONG(173, 216, 230), "LightBlue" },
470 { RGB_TO_ULONG(176, 224, 230), "powder blue" },
471 { RGB_TO_ULONG(176, 224, 230), "PowderBlue" },
472 { RGB_TO_ULONG(175, 238, 238), "pale turquoise" },
473 { RGB_TO_ULONG(175, 238, 238), "PaleTurquoise" },
474 { RGB_TO_ULONG(0 , 206, 209), "dark turquoise" },
475 { RGB_TO_ULONG(0 , 206, 209), "DarkTurquoise" },
476 { RGB_TO_ULONG(72 , 209, 204), "medium turquoise" },
477 { RGB_TO_ULONG(72 , 209, 204), "MediumTurquoise" },
478 { RGB_TO_ULONG(64 , 224, 208), "turquoise" },
479 { RGB_TO_ULONG(0 , 255, 255), "cyan" },
480 { RGB_TO_ULONG(224, 255, 255), "light cyan" },
481 { RGB_TO_ULONG(224, 255, 255), "LightCyan" },
482 { RGB_TO_ULONG(95 , 158, 160), "cadet blue" },
483 { RGB_TO_ULONG(95 , 158, 160), "CadetBlue" },
484 { RGB_TO_ULONG(102, 205, 170), "medium aquamarine" },
485 { RGB_TO_ULONG(102, 205, 170), "MediumAquamarine" },
486 { RGB_TO_ULONG(127, 255, 212), "aquamarine" },
487 { RGB_TO_ULONG(0 , 100, 0 ), "dark green" },
488 { RGB_TO_ULONG(0 , 100, 0 ), "DarkGreen" },
489 { RGB_TO_ULONG(85 , 107, 47 ), "dark olive green" },
490 { RGB_TO_ULONG(85 , 107, 47 ), "DarkOliveGreen" },
491 { RGB_TO_ULONG(143, 188, 143), "dark sea green" },
492 { RGB_TO_ULONG(143, 188, 143), "DarkSeaGreen" },
493 { RGB_TO_ULONG(46 , 139, 87 ), "sea green" },
494 { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen" },
495 { RGB_TO_ULONG(60 , 179, 113), "medium sea green" },
496 { RGB_TO_ULONG(60 , 179, 113), "MediumSeaGreen" },
497 { RGB_TO_ULONG(32 , 178, 170), "light sea green" },
498 { RGB_TO_ULONG(32 , 178, 170), "LightSeaGreen" },
499 { RGB_TO_ULONG(152, 251, 152), "pale green" },
500 { RGB_TO_ULONG(152, 251, 152), "PaleGreen" },
501 { RGB_TO_ULONG(0 , 255, 127), "spring green" },
502 { RGB_TO_ULONG(0 , 255, 127), "SpringGreen" },
503 { RGB_TO_ULONG(124, 252, 0 ), "lawn green" },
504 { RGB_TO_ULONG(124, 252, 0 ), "LawnGreen" },
505 { RGB_TO_ULONG(0 , 255, 0 ), "green" },
506 { RGB_TO_ULONG(127, 255, 0 ), "chartreuse" },
507 { RGB_TO_ULONG(0 , 250, 154), "medium spring green" },
508 { RGB_TO_ULONG(0 , 250, 154), "MediumSpringGreen" },
509 { RGB_TO_ULONG(173, 255, 47 ), "green yellow" },
510 { RGB_TO_ULONG(173, 255, 47 ), "GreenYellow" },
511 { RGB_TO_ULONG(50 , 205, 50 ), "lime green" },
512 { RGB_TO_ULONG(50 , 205, 50 ), "LimeGreen" },
513 { RGB_TO_ULONG(154, 205, 50 ), "yellow green" },
514 { RGB_TO_ULONG(154, 205, 50 ), "YellowGreen" },
515 { RGB_TO_ULONG(34 , 139, 34 ), "forest green" },
516 { RGB_TO_ULONG(34 , 139, 34 ), "ForestGreen" },
517 { RGB_TO_ULONG(107, 142, 35 ), "olive drab" },
518 { RGB_TO_ULONG(107, 142, 35 ), "OliveDrab" },
519 { RGB_TO_ULONG(189, 183, 107), "dark khaki" },
520 { RGB_TO_ULONG(189, 183, 107), "DarkKhaki" },
521 { RGB_TO_ULONG(240, 230, 140), "khaki" },
522 { RGB_TO_ULONG(238, 232, 170), "pale goldenrod" },
523 { RGB_TO_ULONG(238, 232, 170), "PaleGoldenrod" },
524 { RGB_TO_ULONG(250, 250, 210), "light goldenrod yellow" },
525 { RGB_TO_ULONG(250, 250, 210), "LightGoldenrodYellow" },
526 { RGB_TO_ULONG(255, 255, 224), "light yellow" },
527 { RGB_TO_ULONG(255, 255, 224), "LightYellow" },
528 { RGB_TO_ULONG(255, 255, 0 ), "yellow" },
529 { RGB_TO_ULONG(255, 215, 0 ), "gold" },
530 { RGB_TO_ULONG(238, 221, 130), "light goldenrod" },
531 { RGB_TO_ULONG(238, 221, 130), "LightGoldenrod" },
532 { RGB_TO_ULONG(218, 165, 32 ), "goldenrod" },
533 { RGB_TO_ULONG(184, 134, 11 ), "dark goldenrod" },
534 { RGB_TO_ULONG(184, 134, 11 ), "DarkGoldenrod" },
535 { RGB_TO_ULONG(188, 143, 143), "rosy brown" },
536 { RGB_TO_ULONG(188, 143, 143), "RosyBrown" },
537 { RGB_TO_ULONG(205, 92 , 92 ), "indian red" },
538 { RGB_TO_ULONG(205, 92 , 92 ), "IndianRed" },
539 { RGB_TO_ULONG(139, 69 , 19 ), "saddle brown" },
540 { RGB_TO_ULONG(139, 69 , 19 ), "SaddleBrown" },
541 { RGB_TO_ULONG(160, 82 , 45 ), "sienna" },
542 { RGB_TO_ULONG(205, 133, 63 ), "peru" },
543 { RGB_TO_ULONG(222, 184, 135), "burlywood" },
544 { RGB_TO_ULONG(245, 245, 220), "beige" },
545 { RGB_TO_ULONG(245, 222, 179), "wheat" },
546 { RGB_TO_ULONG(244, 164, 96 ), "sandy brown" },
547 { RGB_TO_ULONG(244, 164, 96 ), "SandyBrown" },
548 { RGB_TO_ULONG(210, 180, 140), "tan" },
549 { RGB_TO_ULONG(210, 105, 30 ), "chocolate" },
550 { RGB_TO_ULONG(178, 34 , 34 ), "firebrick" },
551 { RGB_TO_ULONG(165, 42 , 42 ), "brown" },
552 { RGB_TO_ULONG(233, 150, 122), "dark salmon" },
553 { RGB_TO_ULONG(233, 150, 122), "DarkSalmon" },
554 { RGB_TO_ULONG(250, 128, 114), "salmon" },
555 { RGB_TO_ULONG(255, 160, 122), "light salmon" },
556 { RGB_TO_ULONG(255, 160, 122), "LightSalmon" },
557 { RGB_TO_ULONG(255, 165, 0 ), "orange" },
558 { RGB_TO_ULONG(255, 140, 0 ), "dark orange" },
559 { RGB_TO_ULONG(255, 140, 0 ), "DarkOrange" },
560 { RGB_TO_ULONG(255, 127, 80 ), "coral" },
561 { RGB_TO_ULONG(240, 128, 128), "light coral" },
562 { RGB_TO_ULONG(240, 128, 128), "LightCoral" },
563 { RGB_TO_ULONG(255, 99 , 71 ), "tomato" },
564 { RGB_TO_ULONG(255, 69 , 0 ), "orange red" },
565 { RGB_TO_ULONG(255, 69 , 0 ), "OrangeRed" },
566 { RGB_TO_ULONG(255, 0 , 0 ), "red" },
567 { RGB_TO_ULONG(255, 105, 180), "hot pink" },
568 { RGB_TO_ULONG(255, 105, 180), "HotPink" },
569 { RGB_TO_ULONG(255, 20 , 147), "deep pink" },
570 { RGB_TO_ULONG(255, 20 , 147), "DeepPink" },
571 { RGB_TO_ULONG(255, 192, 203), "pink" },
572 { RGB_TO_ULONG(255, 182, 193), "light pink" },
573 { RGB_TO_ULONG(255, 182, 193), "LightPink" },
574 { RGB_TO_ULONG(219, 112, 147), "pale violet red" },
575 { RGB_TO_ULONG(219, 112, 147), "PaleVioletRed" },
576 { RGB_TO_ULONG(176, 48 , 96 ), "maroon" },
577 { RGB_TO_ULONG(199, 21 , 133), "medium violet red" },
578 { RGB_TO_ULONG(199, 21 , 133), "MediumVioletRed" },
579 { RGB_TO_ULONG(208, 32 , 144), "violet red" },
580 { RGB_TO_ULONG(208, 32 , 144), "VioletRed" },
581 { RGB_TO_ULONG(255, 0 , 255), "magenta" },
582 { RGB_TO_ULONG(238, 130, 238), "violet" },
583 { RGB_TO_ULONG(221, 160, 221), "plum" },
584 { RGB_TO_ULONG(218, 112, 214), "orchid" },
585 { RGB_TO_ULONG(186, 85 , 211), "medium orchid" },
586 { RGB_TO_ULONG(186, 85 , 211), "MediumOrchid" },
587 { RGB_TO_ULONG(153, 50 , 204), "dark orchid" },
588 { RGB_TO_ULONG(153, 50 , 204), "DarkOrchid" },
589 { RGB_TO_ULONG(148, 0 , 211), "dark violet" },
590 { RGB_TO_ULONG(148, 0 , 211), "DarkViolet" },
591 { RGB_TO_ULONG(138, 43 , 226), "blue violet" },
592 { RGB_TO_ULONG(138, 43 , 226), "BlueViolet" },
593 { RGB_TO_ULONG(160, 32 , 240), "purple" },
594 { RGB_TO_ULONG(147, 112, 219), "medium purple" },
595 { RGB_TO_ULONG(147, 112, 219), "MediumPurple" },
596 { RGB_TO_ULONG(216, 191, 216), "thistle" },
597 { RGB_TO_ULONG(255, 250, 250), "snow1" },
598 { RGB_TO_ULONG(238, 233, 233), "snow2" },
599 { RGB_TO_ULONG(205, 201, 201), "snow3" },
600 { RGB_TO_ULONG(139, 137, 137), "snow4" },
601 { RGB_TO_ULONG(255, 245, 238), "seashell1" },
602 { RGB_TO_ULONG(238, 229, 222), "seashell2" },
603 { RGB_TO_ULONG(205, 197, 191), "seashell3" },
604 { RGB_TO_ULONG(139, 134, 130), "seashell4" },
605 { RGB_TO_ULONG(255, 239, 219), "AntiqueWhite1" },
606 { RGB_TO_ULONG(238, 223, 204), "AntiqueWhite2" },
607 { RGB_TO_ULONG(205, 192, 176), "AntiqueWhite3" },
608 { RGB_TO_ULONG(139, 131, 120), "AntiqueWhite4" },
609 { RGB_TO_ULONG(255, 228, 196), "bisque1" },
610 { RGB_TO_ULONG(238, 213, 183), "bisque2" },
611 { RGB_TO_ULONG(205, 183, 158), "bisque3" },
612 { RGB_TO_ULONG(139, 125, 107), "bisque4" },
613 { RGB_TO_ULONG(255, 218, 185), "PeachPuff1" },
614 { RGB_TO_ULONG(238, 203, 173), "PeachPuff2" },
615 { RGB_TO_ULONG(205, 175, 149), "PeachPuff3" },
616 { RGB_TO_ULONG(139, 119, 101), "PeachPuff4" },
617 { RGB_TO_ULONG(255, 222, 173), "NavajoWhite1" },
618 { RGB_TO_ULONG(238, 207, 161), "NavajoWhite2" },
619 { RGB_TO_ULONG(205, 179, 139), "NavajoWhite3" },
620 { RGB_TO_ULONG(139, 121, 94), "NavajoWhite4" },
621 { RGB_TO_ULONG(255, 250, 205), "LemonChiffon1" },
622 { RGB_TO_ULONG(238, 233, 191), "LemonChiffon2" },
623 { RGB_TO_ULONG(205, 201, 165), "LemonChiffon3" },
624 { RGB_TO_ULONG(139, 137, 112), "LemonChiffon4" },
625 { RGB_TO_ULONG(255, 248, 220), "cornsilk1" },
626 { RGB_TO_ULONG(238, 232, 205), "cornsilk2" },
627 { RGB_TO_ULONG(205, 200, 177), "cornsilk3" },
628 { RGB_TO_ULONG(139, 136, 120), "cornsilk4" },
629 { RGB_TO_ULONG(255, 255, 240), "ivory1" },
630 { RGB_TO_ULONG(238, 238, 224), "ivory2" },
631 { RGB_TO_ULONG(205, 205, 193), "ivory3" },
632 { RGB_TO_ULONG(139, 139, 131), "ivory4" },
633 { RGB_TO_ULONG(240, 255, 240), "honeydew1" },
634 { RGB_TO_ULONG(224, 238, 224), "honeydew2" },
635 { RGB_TO_ULONG(193, 205, 193), "honeydew3" },
636 { RGB_TO_ULONG(131, 139, 131), "honeydew4" },
637 { RGB_TO_ULONG(255, 240, 245), "LavenderBlush1" },
638 { RGB_TO_ULONG(238, 224, 229), "LavenderBlush2" },
639 { RGB_TO_ULONG(205, 193, 197), "LavenderBlush3" },
640 { RGB_TO_ULONG(139, 131, 134), "LavenderBlush4" },
641 { RGB_TO_ULONG(255, 228, 225), "MistyRose1" },
642 { RGB_TO_ULONG(238, 213, 210), "MistyRose2" },
643 { RGB_TO_ULONG(205, 183, 181), "MistyRose3" },
644 { RGB_TO_ULONG(139, 125, 123), "MistyRose4" },
645 { RGB_TO_ULONG(240, 255, 255), "azure1" },
646 { RGB_TO_ULONG(224, 238, 238), "azure2" },
647 { RGB_TO_ULONG(193, 205, 205), "azure3" },
648 { RGB_TO_ULONG(131, 139, 139), "azure4" },
649 { RGB_TO_ULONG(131, 111, 255), "SlateBlue1" },
650 { RGB_TO_ULONG(122, 103, 238), "SlateBlue2" },
651 { RGB_TO_ULONG(105, 89 , 205), "SlateBlue3" },
652 { RGB_TO_ULONG(71 , 60 , 139), "SlateBlue4" },
653 { RGB_TO_ULONG(72 , 118, 255), "RoyalBlue1" },
654 { RGB_TO_ULONG(67 , 110, 238), "RoyalBlue2" },
655 { RGB_TO_ULONG(58 , 95 , 205), "RoyalBlue3" },
656 { RGB_TO_ULONG(39 , 64 , 139), "RoyalBlue4" },
657 { RGB_TO_ULONG(0 , 0 , 255), "blue1" },
658 { RGB_TO_ULONG(0 , 0 , 238), "blue2" },
659 { RGB_TO_ULONG(0 , 0 , 205), "blue3" },
660 { RGB_TO_ULONG(0 , 0 , 139), "blue4" },
661 { RGB_TO_ULONG(30 , 144, 255), "DodgerBlue1" },
662 { RGB_TO_ULONG(28 , 134, 238), "DodgerBlue2" },
663 { RGB_TO_ULONG(24 , 116, 205), "DodgerBlue3" },
664 { RGB_TO_ULONG(16 , 78 , 139), "DodgerBlue4" },
665 { RGB_TO_ULONG(99 , 184, 255), "SteelBlue1" },
666 { RGB_TO_ULONG(92 , 172, 238), "SteelBlue2" },
667 { RGB_TO_ULONG(79 , 148, 205), "SteelBlue3" },
668 { RGB_TO_ULONG(54 , 100, 139), "SteelBlue4" },
669 { RGB_TO_ULONG(0 , 191, 255), "DeepSkyBlue1" },
670 { RGB_TO_ULONG(0 , 178, 238), "DeepSkyBlue2" },
671 { RGB_TO_ULONG(0 , 154, 205), "DeepSkyBlue3" },
672 { RGB_TO_ULONG(0 , 104, 139), "DeepSkyBlue4" },
673 { RGB_TO_ULONG(135, 206, 255), "SkyBlue1" },
674 { RGB_TO_ULONG(126, 192, 238), "SkyBlue2" },
675 { RGB_TO_ULONG(108, 166, 205), "SkyBlue3" },
676 { RGB_TO_ULONG(74 , 112, 139), "SkyBlue4" },
677 { RGB_TO_ULONG(176, 226, 255), "LightSkyBlue1" },
678 { RGB_TO_ULONG(164, 211, 238), "LightSkyBlue2" },
679 { RGB_TO_ULONG(141, 182, 205), "LightSkyBlue3" },
680 { RGB_TO_ULONG(96 , 123, 139), "LightSkyBlue4" },
681 { RGB_TO_ULONG(198, 226, 255), "SlateGray1" },
682 { RGB_TO_ULONG(185, 211, 238), "SlateGray2" },
683 { RGB_TO_ULONG(159, 182, 205), "SlateGray3" },
684 { RGB_TO_ULONG(108, 123, 139), "SlateGray4" },
685 { RGB_TO_ULONG(202, 225, 255), "LightSteelBlue1" },
686 { RGB_TO_ULONG(188, 210, 238), "LightSteelBlue2" },
687 { RGB_TO_ULONG(162, 181, 205), "LightSteelBlue3" },
688 { RGB_TO_ULONG(110, 123, 139), "LightSteelBlue4" },
689 { RGB_TO_ULONG(191, 239, 255), "LightBlue1" },
690 { RGB_TO_ULONG(178, 223, 238), "LightBlue2" },
691 { RGB_TO_ULONG(154, 192, 205), "LightBlue3" },
692 { RGB_TO_ULONG(104, 131, 139), "LightBlue4" },
693 { RGB_TO_ULONG(224, 255, 255), "LightCyan1" },
694 { RGB_TO_ULONG(209, 238, 238), "LightCyan2" },
695 { RGB_TO_ULONG(180, 205, 205), "LightCyan3" },
696 { RGB_TO_ULONG(122, 139, 139), "LightCyan4" },
697 { RGB_TO_ULONG(187, 255, 255), "PaleTurquoise1" },
698 { RGB_TO_ULONG(174, 238, 238), "PaleTurquoise2" },
699 { RGB_TO_ULONG(150, 205, 205), "PaleTurquoise3" },
700 { RGB_TO_ULONG(102, 139, 139), "PaleTurquoise4" },
701 { RGB_TO_ULONG(152, 245, 255), "CadetBlue1" },
702 { RGB_TO_ULONG(142, 229, 238), "CadetBlue2" },
703 { RGB_TO_ULONG(122, 197, 205), "CadetBlue3" },
704 { RGB_TO_ULONG(83 , 134, 139), "CadetBlue4" },
705 { RGB_TO_ULONG(0 , 245, 255), "turquoise1" },
706 { RGB_TO_ULONG(0 , 229, 238), "turquoise2" },
707 { RGB_TO_ULONG(0 , 197, 205), "turquoise3" },
708 { RGB_TO_ULONG(0 , 134, 139), "turquoise4" },
709 { RGB_TO_ULONG(0 , 255, 255), "cyan1" },
710 { RGB_TO_ULONG(0 , 238, 238), "cyan2" },
711 { RGB_TO_ULONG(0 , 205, 205), "cyan3" },
712 { RGB_TO_ULONG(0 , 139, 139), "cyan4" },
713 { RGB_TO_ULONG(151, 255, 255), "DarkSlateGray1" },
714 { RGB_TO_ULONG(141, 238, 238), "DarkSlateGray2" },
715 { RGB_TO_ULONG(121, 205, 205), "DarkSlateGray3" },
716 { RGB_TO_ULONG(82 , 139, 139), "DarkSlateGray4" },
717 { RGB_TO_ULONG(127, 255, 212), "aquamarine1" },
718 { RGB_TO_ULONG(118, 238, 198), "aquamarine2" },
719 { RGB_TO_ULONG(102, 205, 170), "aquamarine3" },
720 { RGB_TO_ULONG(69 , 139, 116), "aquamarine4" },
721 { RGB_TO_ULONG(193, 255, 193), "DarkSeaGreen1" },
722 { RGB_TO_ULONG(180, 238, 180), "DarkSeaGreen2" },
723 { RGB_TO_ULONG(155, 205, 155), "DarkSeaGreen3" },
724 { RGB_TO_ULONG(105, 139, 105), "DarkSeaGreen4" },
725 { RGB_TO_ULONG(84 , 255, 159), "SeaGreen1" },
726 { RGB_TO_ULONG(78 , 238, 148), "SeaGreen2" },
727 { RGB_TO_ULONG(67 , 205, 128), "SeaGreen3" },
728 { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen4" },
729 { RGB_TO_ULONG(154, 255, 154), "PaleGreen1" },
730 { RGB_TO_ULONG(144, 238, 144), "PaleGreen2" },
731 { RGB_TO_ULONG(124, 205, 124), "PaleGreen3" },
732 { RGB_TO_ULONG(84 , 139, 84 ), "PaleGreen4" },
733 { RGB_TO_ULONG(0 , 255, 127), "SpringGreen1" },
734 { RGB_TO_ULONG(0 , 238, 118), "SpringGreen2" },
735 { RGB_TO_ULONG(0 , 205, 102), "SpringGreen3" },
736 { RGB_TO_ULONG(0 , 139, 69 ), "SpringGreen4" },
737 { RGB_TO_ULONG(0 , 255, 0 ), "green1" },
738 { RGB_TO_ULONG(0 , 238, 0 ), "green2" },
739 { RGB_TO_ULONG(0 , 205, 0 ), "green3" },
740 { RGB_TO_ULONG(0 , 139, 0 ), "green4" },
741 { RGB_TO_ULONG(127, 255, 0 ), "chartreuse1" },
742 { RGB_TO_ULONG(118, 238, 0 ), "chartreuse2" },
743 { RGB_TO_ULONG(102, 205, 0 ), "chartreuse3" },
744 { RGB_TO_ULONG(69 , 139, 0 ), "chartreuse4" },
745 { RGB_TO_ULONG(192, 255, 62 ), "OliveDrab1" },
746 { RGB_TO_ULONG(179, 238, 58 ), "OliveDrab2" },
747 { RGB_TO_ULONG(154, 205, 50 ), "OliveDrab3" },
748 { RGB_TO_ULONG(105, 139, 34 ), "OliveDrab4" },
749 { RGB_TO_ULONG(202, 255, 112), "DarkOliveGreen1" },
750 { RGB_TO_ULONG(188, 238, 104), "DarkOliveGreen2" },
751 { RGB_TO_ULONG(162, 205, 90 ), "DarkOliveGreen3" },
752 { RGB_TO_ULONG(110, 139, 61 ), "DarkOliveGreen4" },
753 { RGB_TO_ULONG(255, 246, 143), "khaki1" },
754 { RGB_TO_ULONG(238, 230, 133), "khaki2" },
755 { RGB_TO_ULONG(205, 198, 115), "khaki3" },
756 { RGB_TO_ULONG(139, 134, 78 ), "khaki4" },
757 { RGB_TO_ULONG(255, 236, 139), "LightGoldenrod1" },
758 { RGB_TO_ULONG(238, 220, 130), "LightGoldenrod2" },
759 { RGB_TO_ULONG(205, 190, 112), "LightGoldenrod3" },
760 { RGB_TO_ULONG(139, 129, 76 ), "LightGoldenrod4" },
761 { RGB_TO_ULONG(255, 255, 224), "LightYellow1" },
762 { RGB_TO_ULONG(238, 238, 209), "LightYellow2" },
763 { RGB_TO_ULONG(205, 205, 180), "LightYellow3" },
764 { RGB_TO_ULONG(139, 139, 122), "LightYellow4" },
765 { RGB_TO_ULONG(255, 255, 0 ), "yellow1" },
766 { RGB_TO_ULONG(238, 238, 0 ), "yellow2" },
767 { RGB_TO_ULONG(205, 205, 0 ), "yellow3" },
768 { RGB_TO_ULONG(139, 139, 0 ), "yellow4" },
769 { RGB_TO_ULONG(255, 215, 0 ), "gold1" },
770 { RGB_TO_ULONG(238, 201, 0 ), "gold2" },
771 { RGB_TO_ULONG(205, 173, 0 ), "gold3" },
772 { RGB_TO_ULONG(139, 117, 0 ), "gold4" },
773 { RGB_TO_ULONG(255, 193, 37 ), "goldenrod1" },
774 { RGB_TO_ULONG(238, 180, 34 ), "goldenrod2" },
775 { RGB_TO_ULONG(205, 155, 29 ), "goldenrod3" },
776 { RGB_TO_ULONG(139, 105, 20 ), "goldenrod4" },
777 { RGB_TO_ULONG(255, 185, 15 ), "DarkGoldenrod1" },
778 { RGB_TO_ULONG(238, 173, 14 ), "DarkGoldenrod2" },
779 { RGB_TO_ULONG(205, 149, 12 ), "DarkGoldenrod3" },
780 { RGB_TO_ULONG(139, 101, 8 ), "DarkGoldenrod4" },
781 { RGB_TO_ULONG(255, 193, 193), "RosyBrown1" },
782 { RGB_TO_ULONG(238, 180, 180), "RosyBrown2" },
783 { RGB_TO_ULONG(205, 155, 155), "RosyBrown3" },
784 { RGB_TO_ULONG(139, 105, 105), "RosyBrown4" },
785 { RGB_TO_ULONG(255, 106, 106), "IndianRed1" },
786 { RGB_TO_ULONG(238, 99 , 99 ), "IndianRed2" },
787 { RGB_TO_ULONG(205, 85 , 85 ), "IndianRed3" },
788 { RGB_TO_ULONG(139, 58 , 58 ), "IndianRed4" },
789 { RGB_TO_ULONG(255, 130, 71 ), "sienna1" },
790 { RGB_TO_ULONG(238, 121, 66 ), "sienna2" },
791 { RGB_TO_ULONG(205, 104, 57 ), "sienna3" },
792 { RGB_TO_ULONG(139, 71 , 38 ), "sienna4" },
793 { RGB_TO_ULONG(255, 211, 155), "burlywood1" },
794 { RGB_TO_ULONG(238, 197, 145), "burlywood2" },
795 { RGB_TO_ULONG(205, 170, 125), "burlywood3" },
796 { RGB_TO_ULONG(139, 115, 85 ), "burlywood4" },
797 { RGB_TO_ULONG(255, 231, 186), "wheat1" },
798 { RGB_TO_ULONG(238, 216, 174), "wheat2" },
799 { RGB_TO_ULONG(205, 186, 150), "wheat3" },
800 { RGB_TO_ULONG(139, 126, 102), "wheat4" },
801 { RGB_TO_ULONG(255, 165, 79 ), "tan1" },
802 { RGB_TO_ULONG(238, 154, 73 ), "tan2" },
803 { RGB_TO_ULONG(205, 133, 63 ), "tan3" },
804 { RGB_TO_ULONG(139, 90 , 43 ), "tan4" },
805 { RGB_TO_ULONG(255, 127, 36 ), "chocolate1" },
806 { RGB_TO_ULONG(238, 118, 33 ), "chocolate2" },
807 { RGB_TO_ULONG(205, 102, 29 ), "chocolate3" },
808 { RGB_TO_ULONG(139, 69 , 19 ), "chocolate4" },
809 { RGB_TO_ULONG(255, 48 , 48 ), "firebrick1" },
810 { RGB_TO_ULONG(238, 44 , 44 ), "firebrick2" },
811 { RGB_TO_ULONG(205, 38 , 38 ), "firebrick3" },
812 { RGB_TO_ULONG(139, 26 , 26 ), "firebrick4" },
813 { RGB_TO_ULONG(255, 64 , 64 ), "brown1" },
814 { RGB_TO_ULONG(238, 59 , 59 ), "brown2" },
815 { RGB_TO_ULONG(205, 51 , 51 ), "brown3" },
816 { RGB_TO_ULONG(139, 35 , 35 ), "brown4" },
817 { RGB_TO_ULONG(255, 140, 105), "salmon1" },
818 { RGB_TO_ULONG(238, 130, 98 ), "salmon2" },
819 { RGB_TO_ULONG(205, 112, 84 ), "salmon3" },
820 { RGB_TO_ULONG(139, 76 , 57 ), "salmon4" },
821 { RGB_TO_ULONG(255, 160, 122), "LightSalmon1" },
822 { RGB_TO_ULONG(238, 149, 114), "LightSalmon2" },
823 { RGB_TO_ULONG(205, 129, 98 ), "LightSalmon3" },
824 { RGB_TO_ULONG(139, 87 , 66 ), "LightSalmon4" },
825 { RGB_TO_ULONG(255, 165, 0 ), "orange1" },
826 { RGB_TO_ULONG(238, 154, 0 ), "orange2" },
827 { RGB_TO_ULONG(205, 133, 0 ), "orange3" },
828 { RGB_TO_ULONG(139, 90 , 0 ), "orange4" },
829 { RGB_TO_ULONG(255, 127, 0 ), "DarkOrange1" },
830 { RGB_TO_ULONG(238, 118, 0 ), "DarkOrange2" },
831 { RGB_TO_ULONG(205, 102, 0 ), "DarkOrange3" },
832 { RGB_TO_ULONG(139, 69 , 0 ), "DarkOrange4" },
833 { RGB_TO_ULONG(255, 114, 86 ), "coral1" },
834 { RGB_TO_ULONG(238, 106, 80 ), "coral2" },
835 { RGB_TO_ULONG(205, 91 , 69 ), "coral3" },
836 { RGB_TO_ULONG(139, 62 , 47 ), "coral4" },
837 { RGB_TO_ULONG(255, 99 , 71 ), "tomato1" },
838 { RGB_TO_ULONG(238, 92 , 66 ), "tomato2" },
839 { RGB_TO_ULONG(205, 79 , 57 ), "tomato3" },
840 { RGB_TO_ULONG(139, 54 , 38 ), "tomato4" },
841 { RGB_TO_ULONG(255, 69 , 0 ), "OrangeRed1" },
842 { RGB_TO_ULONG(238, 64 , 0 ), "OrangeRed2" },
843 { RGB_TO_ULONG(205, 55 , 0 ), "OrangeRed3" },
844 { RGB_TO_ULONG(139, 37 , 0 ), "OrangeRed4" },
845 { RGB_TO_ULONG(255, 0 , 0 ), "red1" },
846 { RGB_TO_ULONG(238, 0 , 0 ), "red2" },
847 { RGB_TO_ULONG(205, 0 , 0 ), "red3" },
848 { RGB_TO_ULONG(139, 0 , 0 ), "red4" },
849 { RGB_TO_ULONG(255, 20 , 147), "DeepPink1" },
850 { RGB_TO_ULONG(238, 18 , 137), "DeepPink2" },
851 { RGB_TO_ULONG(205, 16 , 118), "DeepPink3" },
852 { RGB_TO_ULONG(139, 10 , 80 ), "DeepPink4" },
853 { RGB_TO_ULONG(255, 110, 180), "HotPink1" },
854 { RGB_TO_ULONG(238, 106, 167), "HotPink2" },
855 { RGB_TO_ULONG(205, 96 , 144), "HotPink3" },
856 { RGB_TO_ULONG(139, 58 , 98 ), "HotPink4" },
857 { RGB_TO_ULONG(255, 181, 197), "pink1" },
858 { RGB_TO_ULONG(238, 169, 184), "pink2" },
859 { RGB_TO_ULONG(205, 145, 158), "pink3" },
860 { RGB_TO_ULONG(139, 99 , 108), "pink4" },
861 { RGB_TO_ULONG(255, 174, 185), "LightPink1" },
862 { RGB_TO_ULONG(238, 162, 173), "LightPink2" },
863 { RGB_TO_ULONG(205, 140, 149), "LightPink3" },
864 { RGB_TO_ULONG(139, 95 , 101), "LightPink4" },
865 { RGB_TO_ULONG(255, 130, 171), "PaleVioletRed1" },
866 { RGB_TO_ULONG(238, 121, 159), "PaleVioletRed2" },
867 { RGB_TO_ULONG(205, 104, 137), "PaleVioletRed3" },
868 { RGB_TO_ULONG(139, 71 , 93 ), "PaleVioletRed4" },
869 { RGB_TO_ULONG(255, 52 , 179), "maroon1" },
870 { RGB_TO_ULONG(238, 48 , 167), "maroon2" },
871 { RGB_TO_ULONG(205, 41 , 144), "maroon3" },
872 { RGB_TO_ULONG(139, 28 , 98 ), "maroon4" },
873 { RGB_TO_ULONG(255, 62 , 150), "VioletRed1" },
874 { RGB_TO_ULONG(238, 58 , 140), "VioletRed2" },
875 { RGB_TO_ULONG(205, 50 , 120), "VioletRed3" },
876 { RGB_TO_ULONG(139, 34 , 82 ), "VioletRed4" },
877 { RGB_TO_ULONG(255, 0 , 255), "magenta1" },
878 { RGB_TO_ULONG(238, 0 , 238), "magenta2" },
879 { RGB_TO_ULONG(205, 0 , 205), "magenta3" },
880 { RGB_TO_ULONG(139, 0 , 139), "magenta4" },
881 { RGB_TO_ULONG(255, 131, 250), "orchid1" },
882 { RGB_TO_ULONG(238, 122, 233), "orchid2" },
883 { RGB_TO_ULONG(205, 105, 201), "orchid3" },
884 { RGB_TO_ULONG(139, 71 , 137), "orchid4" },
885 { RGB_TO_ULONG(255, 187, 255), "plum1" },
886 { RGB_TO_ULONG(238, 174, 238), "plum2" },
887 { RGB_TO_ULONG(205, 150, 205), "plum3" },
888 { RGB_TO_ULONG(139, 102, 139), "plum4" },
889 { RGB_TO_ULONG(224, 102, 255), "MediumOrchid1" },
890 { RGB_TO_ULONG(209, 95 , 238), "MediumOrchid2" },
891 { RGB_TO_ULONG(180, 82 , 205), "MediumOrchid3" },
892 { RGB_TO_ULONG(122, 55 , 139), "MediumOrchid4" },
893 { RGB_TO_ULONG(191, 62 , 255), "DarkOrchid1" },
894 { RGB_TO_ULONG(178, 58 , 238), "DarkOrchid2" },
895 { RGB_TO_ULONG(154, 50 , 205), "DarkOrchid3" },
896 { RGB_TO_ULONG(104, 34 , 139), "DarkOrchid4" },
897 { RGB_TO_ULONG(155, 48 , 255), "purple1" },
898 { RGB_TO_ULONG(145, 44 , 238), "purple2" },
899 { RGB_TO_ULONG(125, 38 , 205), "purple3" },
900 { RGB_TO_ULONG(85 , 26 , 139), "purple4" },
901 { RGB_TO_ULONG(171, 130, 255), "MediumPurple1" },
902 { RGB_TO_ULONG(159, 121, 238), "MediumPurple2" },
903 { RGB_TO_ULONG(137, 104, 205), "MediumPurple3" },
904 { RGB_TO_ULONG(93 , 71 , 139), "MediumPurple4" },
905 { RGB_TO_ULONG(255, 225, 255), "thistle1" },
906 { RGB_TO_ULONG(238, 210, 238), "thistle2" },
907 { RGB_TO_ULONG(205, 181, 205), "thistle3" },
908 { RGB_TO_ULONG(139, 123, 139), "thistle4" },
909 { RGB_TO_ULONG(0 , 0 , 0 ), "gray0" },
910 { RGB_TO_ULONG(0 , 0 , 0 ), "grey0" },
911 { RGB_TO_ULONG(3 , 3 , 3 ), "gray1" },
912 { RGB_TO_ULONG(3 , 3 , 3 ), "grey1" },
913 { RGB_TO_ULONG(5 , 5 , 5 ), "gray2" },
914 { RGB_TO_ULONG(5 , 5 , 5 ), "grey2" },
915 { RGB_TO_ULONG(8 , 8 , 8 ), "gray3" },
916 { RGB_TO_ULONG(8 , 8 , 8 ), "grey3" },
917 { RGB_TO_ULONG(10 , 10 , 10 ), "gray4" },
918 { RGB_TO_ULONG(10 , 10 , 10 ), "grey4" },
919 { RGB_TO_ULONG(13 , 13 , 13 ), "gray5" },
920 { RGB_TO_ULONG(13 , 13 , 13 ), "grey5" },
921 { RGB_TO_ULONG(15 , 15 , 15 ), "gray6" },
922 { RGB_TO_ULONG(15 , 15 , 15 ), "grey6" },
923 { RGB_TO_ULONG(18 , 18 , 18 ), "gray7" },
924 { RGB_TO_ULONG(18 , 18 , 18 ), "grey7" },
925 { RGB_TO_ULONG(20 , 20 , 20 ), "gray8" },
926 { RGB_TO_ULONG(20 , 20 , 20 ), "grey8" },
927 { RGB_TO_ULONG(23 , 23 , 23 ), "gray9" },
928 { RGB_TO_ULONG(23 , 23 , 23 ), "grey9" },
929 { RGB_TO_ULONG(26 , 26 , 26 ), "gray10" },
930 { RGB_TO_ULONG(26 , 26 , 26 ), "grey10" },
931 { RGB_TO_ULONG(28 , 28 , 28 ), "gray11" },
932 { RGB_TO_ULONG(28 , 28 , 28 ), "grey11" },
933 { RGB_TO_ULONG(31 , 31 , 31 ), "gray12" },
934 { RGB_TO_ULONG(31 , 31 , 31 ), "grey12" },
935 { RGB_TO_ULONG(33 , 33 , 33 ), "gray13" },
936 { RGB_TO_ULONG(33 , 33 , 33 ), "grey13" },
937 { RGB_TO_ULONG(36 , 36 , 36 ), "gray14" },
938 { RGB_TO_ULONG(36 , 36 , 36 ), "grey14" },
939 { RGB_TO_ULONG(38 , 38 , 38 ), "gray15" },
940 { RGB_TO_ULONG(38 , 38 , 38 ), "grey15" },
941 { RGB_TO_ULONG(41 , 41 , 41 ), "gray16" },
942 { RGB_TO_ULONG(41 , 41 , 41 ), "grey16" },
943 { RGB_TO_ULONG(43 , 43 , 43 ), "gray17" },
944 { RGB_TO_ULONG(43 , 43 , 43 ), "grey17" },
945 { RGB_TO_ULONG(46 , 46 , 46 ), "gray18" },
946 { RGB_TO_ULONG(46 , 46 , 46 ), "grey18" },
947 { RGB_TO_ULONG(48 , 48 , 48 ), "gray19" },
948 { RGB_TO_ULONG(48 , 48 , 48 ), "grey19" },
949 { RGB_TO_ULONG(51 , 51 , 51 ), "gray20" },
950 { RGB_TO_ULONG(51 , 51 , 51 ), "grey20" },
951 { RGB_TO_ULONG(54 , 54 , 54 ), "gray21" },
952 { RGB_TO_ULONG(54 , 54 , 54 ), "grey21" },
953 { RGB_TO_ULONG(56 , 56 , 56 ), "gray22" },
954 { RGB_TO_ULONG(56 , 56 , 56 ), "grey22" },
955 { RGB_TO_ULONG(59 , 59 , 59 ), "gray23" },
956 { RGB_TO_ULONG(59 , 59 , 59 ), "grey23" },
957 { RGB_TO_ULONG(61 , 61 , 61 ), "gray24" },
958 { RGB_TO_ULONG(61 , 61 , 61 ), "grey24" },
959 { RGB_TO_ULONG(64 , 64 , 64 ), "gray25" },
960 { RGB_TO_ULONG(64 , 64 , 64 ), "grey25" },
961 { RGB_TO_ULONG(66 , 66 , 66 ), "gray26" },
962 { RGB_TO_ULONG(66 , 66 , 66 ), "grey26" },
963 { RGB_TO_ULONG(69 , 69 , 69 ), "gray27" },
964 { RGB_TO_ULONG(69 , 69 , 69 ), "grey27" },
965 { RGB_TO_ULONG(71 , 71 , 71 ), "gray28" },
966 { RGB_TO_ULONG(71 , 71 , 71 ), "grey28" },
967 { RGB_TO_ULONG(74 , 74 , 74 ), "gray29" },
968 { RGB_TO_ULONG(74 , 74 , 74 ), "grey29" },
969 { RGB_TO_ULONG(77 , 77 , 77 ), "gray30" },
970 { RGB_TO_ULONG(77 , 77 , 77 ), "grey30" },
971 { RGB_TO_ULONG(79 , 79 , 79 ), "gray31" },
972 { RGB_TO_ULONG(79 , 79 , 79 ), "grey31" },
973 { RGB_TO_ULONG(82 , 82 , 82 ), "gray32" },
974 { RGB_TO_ULONG(82 , 82 , 82 ), "grey32" },
975 { RGB_TO_ULONG(84 , 84 , 84 ), "gray33" },
976 { RGB_TO_ULONG(84 , 84 , 84 ), "grey33" },
977 { RGB_TO_ULONG(87 , 87 , 87 ), "gray34" },
978 { RGB_TO_ULONG(87 , 87 , 87 ), "grey34" },
979 { RGB_TO_ULONG(89 , 89 , 89 ), "gray35" },
980 { RGB_TO_ULONG(89 , 89 , 89 ), "grey35" },
981 { RGB_TO_ULONG(92 , 92 , 92 ), "gray36" },
982 { RGB_TO_ULONG(92 , 92 , 92 ), "grey36" },
983 { RGB_TO_ULONG(94 , 94 , 94 ), "gray37" },
984 { RGB_TO_ULONG(94 , 94 , 94 ), "grey37" },
985 { RGB_TO_ULONG(97 , 97 , 97 ), "gray38" },
986 { RGB_TO_ULONG(97 , 97 , 97 ), "grey38" },
987 { RGB_TO_ULONG(99 , 99 , 99 ), "gray39" },
988 { RGB_TO_ULONG(99 , 99 , 99 ), "grey39" },
989 { RGB_TO_ULONG(102, 102, 102), "gray40" },
990 { RGB_TO_ULONG(102, 102, 102), "grey40" },
991 { RGB_TO_ULONG(105, 105, 105), "gray41" },
992 { RGB_TO_ULONG(105, 105, 105), "grey41" },
993 { RGB_TO_ULONG(107, 107, 107), "gray42" },
994 { RGB_TO_ULONG(107, 107, 107), "grey42" },
995 { RGB_TO_ULONG(110, 110, 110), "gray43" },
996 { RGB_TO_ULONG(110, 110, 110), "grey43" },
997 { RGB_TO_ULONG(112, 112, 112), "gray44" },
998 { RGB_TO_ULONG(112, 112, 112), "grey44" },
999 { RGB_TO_ULONG(115, 115, 115), "gray45" },
1000 { RGB_TO_ULONG(115, 115, 115), "grey45" },
1001 { RGB_TO_ULONG(117, 117, 117), "gray46" },
1002 { RGB_TO_ULONG(117, 117, 117), "grey46" },
1003 { RGB_TO_ULONG(120, 120, 120), "gray47" },
1004 { RGB_TO_ULONG(120, 120, 120), "grey47" },
1005 { RGB_TO_ULONG(122, 122, 122), "gray48" },
1006 { RGB_TO_ULONG(122, 122, 122), "grey48" },
1007 { RGB_TO_ULONG(125, 125, 125), "gray49" },
1008 { RGB_TO_ULONG(125, 125, 125), "grey49" },
1009 { RGB_TO_ULONG(127, 127, 127), "gray50" },
1010 { RGB_TO_ULONG(127, 127, 127), "grey50" },
1011 { RGB_TO_ULONG(130, 130, 130), "gray51" },
1012 { RGB_TO_ULONG(130, 130, 130), "grey51" },
1013 { RGB_TO_ULONG(133, 133, 133), "gray52" },
1014 { RGB_TO_ULONG(133, 133, 133), "grey52" },
1015 { RGB_TO_ULONG(135, 135, 135), "gray53" },
1016 { RGB_TO_ULONG(135, 135, 135), "grey53" },
1017 { RGB_TO_ULONG(138, 138, 138), "gray54" },
1018 { RGB_TO_ULONG(138, 138, 138), "grey54" },
1019 { RGB_TO_ULONG(140, 140, 140), "gray55" },
1020 { RGB_TO_ULONG(140, 140, 140), "grey55" },
1021 { RGB_TO_ULONG(143, 143, 143), "gray56" },
1022 { RGB_TO_ULONG(143, 143, 143), "grey56" },
1023 { RGB_TO_ULONG(145, 145, 145), "gray57" },
1024 { RGB_TO_ULONG(145, 145, 145), "grey57" },
1025 { RGB_TO_ULONG(148, 148, 148), "gray58" },
1026 { RGB_TO_ULONG(148, 148, 148), "grey58" },
1027 { RGB_TO_ULONG(150, 150, 150), "gray59" },
1028 { RGB_TO_ULONG(150, 150, 150), "grey59" },
1029 { RGB_TO_ULONG(153, 153, 153), "gray60" },
1030 { RGB_TO_ULONG(153, 153, 153), "grey60" },
1031 { RGB_TO_ULONG(156, 156, 156), "gray61" },
1032 { RGB_TO_ULONG(156, 156, 156), "grey61" },
1033 { RGB_TO_ULONG(158, 158, 158), "gray62" },
1034 { RGB_TO_ULONG(158, 158, 158), "grey62" },
1035 { RGB_TO_ULONG(161, 161, 161), "gray63" },
1036 { RGB_TO_ULONG(161, 161, 161), "grey63" },
1037 { RGB_TO_ULONG(163, 163, 163), "gray64" },
1038 { RGB_TO_ULONG(163, 163, 163), "grey64" },
1039 { RGB_TO_ULONG(166, 166, 166), "gray65" },
1040 { RGB_TO_ULONG(166, 166, 166), "grey65" },
1041 { RGB_TO_ULONG(168, 168, 168), "gray66" },
1042 { RGB_TO_ULONG(168, 168, 168), "grey66" },
1043 { RGB_TO_ULONG(171, 171, 171), "gray67" },
1044 { RGB_TO_ULONG(171, 171, 171), "grey67" },
1045 { RGB_TO_ULONG(173, 173, 173), "gray68" },
1046 { RGB_TO_ULONG(173, 173, 173), "grey68" },
1047 { RGB_TO_ULONG(176, 176, 176), "gray69" },
1048 { RGB_TO_ULONG(176, 176, 176), "grey69" },
1049 { RGB_TO_ULONG(179, 179, 179), "gray70" },
1050 { RGB_TO_ULONG(179, 179, 179), "grey70" },
1051 { RGB_TO_ULONG(181, 181, 181), "gray71" },
1052 { RGB_TO_ULONG(181, 181, 181), "grey71" },
1053 { RGB_TO_ULONG(184, 184, 184), "gray72" },
1054 { RGB_TO_ULONG(184, 184, 184), "grey72" },
1055 { RGB_TO_ULONG(186, 186, 186), "gray73" },
1056 { RGB_TO_ULONG(186, 186, 186), "grey73" },
1057 { RGB_TO_ULONG(189, 189, 189), "gray74" },
1058 { RGB_TO_ULONG(189, 189, 189), "grey74" },
1059 { RGB_TO_ULONG(191, 191, 191), "gray75" },
1060 { RGB_TO_ULONG(191, 191, 191), "grey75" },
1061 { RGB_TO_ULONG(194, 194, 194), "gray76" },
1062 { RGB_TO_ULONG(194, 194, 194), "grey76" },
1063 { RGB_TO_ULONG(196, 196, 196), "gray77" },
1064 { RGB_TO_ULONG(196, 196, 196), "grey77" },
1065 { RGB_TO_ULONG(199, 199, 199), "gray78" },
1066 { RGB_TO_ULONG(199, 199, 199), "grey78" },
1067 { RGB_TO_ULONG(201, 201, 201), "gray79" },
1068 { RGB_TO_ULONG(201, 201, 201), "grey79" },
1069 { RGB_TO_ULONG(204, 204, 204), "gray80" },
1070 { RGB_TO_ULONG(204, 204, 204), "grey80" },
1071 { RGB_TO_ULONG(207, 207, 207), "gray81" },
1072 { RGB_TO_ULONG(207, 207, 207), "grey81" },
1073 { RGB_TO_ULONG(209, 209, 209), "gray82" },
1074 { RGB_TO_ULONG(209, 209, 209), "grey82" },
1075 { RGB_TO_ULONG(212, 212, 212), "gray83" },
1076 { RGB_TO_ULONG(212, 212, 212), "grey83" },
1077 { RGB_TO_ULONG(214, 214, 214), "gray84" },
1078 { RGB_TO_ULONG(214, 214, 214), "grey84" },
1079 { RGB_TO_ULONG(217, 217, 217), "gray85" },
1080 { RGB_TO_ULONG(217, 217, 217), "grey85" },
1081 { RGB_TO_ULONG(219, 219, 219), "gray86" },
1082 { RGB_TO_ULONG(219, 219, 219), "grey86" },
1083 { RGB_TO_ULONG(222, 222, 222), "gray87" },
1084 { RGB_TO_ULONG(222, 222, 222), "grey87" },
1085 { RGB_TO_ULONG(224, 224, 224), "gray88" },
1086 { RGB_TO_ULONG(224, 224, 224), "grey88" },
1087 { RGB_TO_ULONG(227, 227, 227), "gray89" },
1088 { RGB_TO_ULONG(227, 227, 227), "grey89" },
1089 { RGB_TO_ULONG(229, 229, 229), "gray90" },
1090 { RGB_TO_ULONG(229, 229, 229), "grey90" },
1091 { RGB_TO_ULONG(232, 232, 232), "gray91" },
1092 { RGB_TO_ULONG(232, 232, 232), "grey91" },
1093 { RGB_TO_ULONG(235, 235, 235), "gray92" },
1094 { RGB_TO_ULONG(235, 235, 235), "grey92" },
1095 { RGB_TO_ULONG(237, 237, 237), "gray93" },
1096 { RGB_TO_ULONG(237, 237, 237), "grey93" },
1097 { RGB_TO_ULONG(240, 240, 240), "gray94" },
1098 { RGB_TO_ULONG(240, 240, 240), "grey94" },
1099 { RGB_TO_ULONG(242, 242, 242), "gray95" },
1100 { RGB_TO_ULONG(242, 242, 242), "grey95" },
1101 { RGB_TO_ULONG(245, 245, 245), "gray96" },
1102 { RGB_TO_ULONG(245, 245, 245), "grey96" },
1103 { RGB_TO_ULONG(247, 247, 247), "gray97" },
1104 { RGB_TO_ULONG(247, 247, 247), "grey97" },
1105 { RGB_TO_ULONG(250, 250, 250), "gray98" },
1106 { RGB_TO_ULONG(250, 250, 250), "grey98" },
1107 { RGB_TO_ULONG(252, 252, 252), "gray99" },
1108 { RGB_TO_ULONG(252, 252, 252), "grey99" },
1109 { RGB_TO_ULONG(255, 255, 255), "gray100" },
1110 { RGB_TO_ULONG(255, 255, 255), "grey100" },
1111 { RGB_TO_ULONG(169, 169, 169), "dark grey" },
1112 { RGB_TO_ULONG(169, 169, 169), "DarkGrey" },
1113 { RGB_TO_ULONG(169, 169, 169), "dark gray" },
1114 { RGB_TO_ULONG(169, 169, 169), "DarkGray" },
1115 { RGB_TO_ULONG(0 , 0 , 139), "dark blue" },
1116 { RGB_TO_ULONG(0 , 0 , 139), "DarkBlue" },
1117 { RGB_TO_ULONG(0 , 139, 139), "dark cyan" },
1118 { RGB_TO_ULONG(0 , 139, 139), "DarkCyan" },
1119 { RGB_TO_ULONG(139, 0 , 139), "dark magenta" },
1120 { RGB_TO_ULONG(139, 0 , 139), "DarkMagenta" },
1121 { RGB_TO_ULONG(139, 0 , 0 ), "dark red" },
1122 { RGB_TO_ULONG(139, 0 , 0 ), "DarkRed" },
1123 { RGB_TO_ULONG(144, 238, 144), "light green" },
1124 { RGB_TO_ULONG(144, 238, 144), "LightGreen" }
1128 mac_color_map_lookup (colorname
)
1131 Lisp_Object ret
= Qnil
;
1136 for (i
= 0; i
< sizeof (mac_color_map
) / sizeof (mac_color_map
[0]); i
++)
1137 if (stricmp (colorname
, mac_color_map
[i
].name
) == 0)
1139 ret
= make_number (mac_color_map
[i
].color
);
1149 x_to_mac_color (colorname
)
1152 register Lisp_Object tail
, ret
= Qnil
;
1156 if (colorname
[0] == '#')
1158 /* Could be an old-style RGB Device specification. */
1161 color
= colorname
+ 1;
1163 size
= strlen(color
);
1164 if (size
== 3 || size
== 6 || size
== 9 || size
== 12)
1166 unsigned long colorval
;
1172 for (i
= 0; i
< 3; i
++)
1176 unsigned long value
;
1178 /* The check for 'x' in the following conditional takes into
1179 account the fact that strtol allows a "0x" in front of
1180 our numbers, and we don't. */
1181 if (!isxdigit(color
[0]) || color
[1] == 'x')
1185 value
= strtoul(color
, &end
, 16);
1187 if (errno
== ERANGE
|| end
- color
!= size
)
1192 value
= value
* 0x10;
1203 colorval
|= (value
<< pos
);
1208 return make_number (colorval
);
1214 else if (strnicmp(colorname
, "rgb:", 4) == 0)
1217 unsigned long colorval
;
1222 color
= colorname
+ 4;
1223 for (i
= 0; i
< 3; i
++)
1226 unsigned long value
;
1228 /* The check for 'x' in the following conditional takes into
1229 account the fact that strtol allows a "0x" in front of
1230 our numbers, and we don't. */
1231 if (!isxdigit(color
[0]) || color
[1] == 'x')
1233 value
= strtoul(color
, &end
, 16);
1234 if (errno
== ERANGE
)
1236 switch (end
- color
)
1239 value
= value
* 0x10 + value
;
1252 if (value
== ULONG_MAX
)
1254 colorval
|= (value
<< pos
);
1261 return make_number (colorval
);
1268 else if (strnicmp(colorname
, "rgbi:", 5) == 0)
1270 /* This is an RGB Intensity specification. */
1272 unsigned long colorval
;
1277 color
= colorname
+ 5;
1278 for (i
= 0; i
< 3; i
++)
1284 value
= strtod(color
, &end
);
1285 if (errno
== ERANGE
)
1287 if (value
< 0.0 || value
> 1.0)
1289 val
= (unsigned long)(0x100 * value
);
1290 /* We used 0x100 instead of 0xFF to give a continuous
1291 range between 0.0 and 1.0 inclusive. The next statement
1292 fixes the 1.0 case. */
1295 colorval
|= (val
<< pos
);
1302 return make_number (colorval
);
1310 ret
= mac_color_map_lookup (colorname
);
1316 /* Gamma-correct COLOR on frame F. */
1319 gamma_correct (f
, color
)
1321 unsigned long *color
;
1325 unsigned long red
, green
, blue
;
1327 red
= pow (RED_FROM_ULONG (*color
) / 255.0, f
->gamma
) * 255.0 + 0.5;
1328 green
= pow (GREEN_FROM_ULONG (*color
) / 255.0, f
->gamma
) * 255.0 + 0.5;
1329 blue
= pow (BLUE_FROM_ULONG (*color
) / 255.0, f
->gamma
) * 255.0 + 0.5;
1330 *color
= RGB_TO_ULONG (red
, green
, blue
);
1334 /* Decide if color named COLOR is valid for the display associated
1335 with the selected frame; if so, return the rgb values in COLOR_DEF.
1336 If ALLOC is nonzero, allocate a new colormap cell. */
1339 mac_defined_color (f
, color
, color_def
, alloc
)
1345 register Lisp_Object tem
;
1346 unsigned long mac_color_ref
;
1348 tem
= x_to_mac_color (color
);
1354 /* Apply gamma correction. */
1355 mac_color_ref
= XUINT (tem
);
1356 gamma_correct (f
, &mac_color_ref
);
1357 XSETINT (tem
, mac_color_ref
);
1360 color_def
->pixel
= mac_color_ref
;
1361 color_def
->red
= RED16_FROM_ULONG (mac_color_ref
);
1362 color_def
->green
= GREEN16_FROM_ULONG (mac_color_ref
);
1363 color_def
->blue
= BLUE16_FROM_ULONG (mac_color_ref
);
1373 /* Given a string ARG naming a color, compute a pixel value from it
1374 suitable for screen F.
1375 If F is not a color screen, return DEF (default) regardless of what
1379 x_decode_color (f
, arg
, def
)
1388 if (strcmp (SDATA (arg
), "black") == 0)
1389 return BLACK_PIX_DEFAULT (f
);
1390 else if (strcmp (SDATA (arg
), "white") == 0)
1391 return WHITE_PIX_DEFAULT (f
);
1394 if (FRAME_MAC_DISPLAY_INFO (f
)->n_planes
) == 1)
1398 if (mac_defined_color (f
, SDATA (arg
), &cdef
, 1))
1401 /* defined_color failed; return an ultimate default. */
1405 /* Functions called only from `x_set_frame_param'
1406 to set individual parameters.
1408 If FRAME_MAC_WINDOW (f) is 0,
1409 the frame is being created and its window does not exist yet.
1410 In that case, just record the parameter's new value
1411 in the standard place; do not attempt to change the window. */
1414 x_set_foreground_color (f
, arg
, oldval
)
1416 Lisp_Object arg
, oldval
;
1418 unsigned long fg
, old_fg
;
1420 fg
= x_decode_color (f
, arg
, BLACK_PIX_DEFAULT (f
));
1421 old_fg
= FRAME_FOREGROUND_PIXEL (f
);
1422 FRAME_FOREGROUND_PIXEL (f
) = fg
;
1424 if (FRAME_MAC_WINDOW (f
) != 0)
1426 update_face_from_frame_parameter (f
, Qforeground_color
, arg
);
1427 if (FRAME_VISIBLE_P (f
))
1433 x_set_background_color (f
, arg
, oldval
)
1435 Lisp_Object arg
, oldval
;
1437 FRAME_BACKGROUND_PIXEL (f
)
1438 = x_decode_color (f
, arg
, WHITE_PIX_DEFAULT (f
));
1440 if (FRAME_MAC_WINDOW (f
) != 0)
1442 update_face_from_frame_parameter (f
, Qbackground_color
, arg
);
1444 if (FRAME_VISIBLE_P (f
))
1450 x_set_mouse_color (f
, arg
, oldval
)
1452 Lisp_Object arg
, oldval
;
1454 Cursor cursor
, nontext_cursor
, mode_cursor
, hand_cursor
;
1458 if (!EQ (Qnil
, arg
))
1459 f
->output_data
.mac
->mouse_pixel
1460 = x_decode_color (f
, arg
, BLACK_PIX_DEFAULT (f
));
1461 mask_color
= FRAME_BACKGROUND_PIXEL (f
);
1463 /* Don't let pointers be invisible. */
1464 if (mask_color
== f
->output_data
.mac
->mouse_pixel
1465 && mask_color
== FRAME_BACKGROUND_PIXEL (f
))
1466 f
->output_data
.mac
->mouse_pixel
= FRAME_FOREGROUND_PIXEL (f
);
1468 #if 0 /* MAC_TODO : cursor changes */
1471 /* It's not okay to crash if the user selects a screwy cursor. */
1472 count
= x_catch_errors (FRAME_W32_DISPLAY (f
));
1474 if (!EQ (Qnil
, Vx_pointer_shape
))
1476 CHECK_NUMBER (Vx_pointer_shape
);
1477 cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XINT (Vx_pointer_shape
));
1480 cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_xterm
);
1481 x_check_errors (FRAME_W32_DISPLAY (f
), "bad text pointer cursor: %s");
1483 if (!EQ (Qnil
, Vx_nontext_pointer_shape
))
1485 CHECK_NUMBER (Vx_nontext_pointer_shape
);
1486 nontext_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1487 XINT (Vx_nontext_pointer_shape
));
1490 nontext_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_left_ptr
);
1491 x_check_errors (FRAME_W32_DISPLAY (f
), "bad nontext pointer cursor: %s");
1493 if (!EQ (Qnil
, Vx_hourglass_pointer_shape
))
1495 CHECK_NUMBER (Vx_hourglass_pointer_shape
);
1496 hourglass_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1497 XINT (Vx_hourglass_pointer_shape
));
1500 hourglass_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_watch
);
1501 x_check_errors (FRAME_W32_DISPLAY (f
), "bad busy pointer cursor: %s");
1503 x_check_errors (FRAME_W32_DISPLAY (f
), "bad nontext pointer cursor: %s");
1504 if (!EQ (Qnil
, Vx_mode_pointer_shape
))
1506 CHECK_NUMBER (Vx_mode_pointer_shape
);
1507 mode_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1508 XINT (Vx_mode_pointer_shape
));
1511 mode_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_xterm
);
1512 x_check_errors (FRAME_W32_DISPLAY (f
), "bad modeline pointer cursor: %s");
1514 if (!EQ (Qnil
, Vx_sensitive_text_pointer_shape
))
1516 CHECK_NUMBER (Vx_sensitive_text_pointer_shape
);
1518 = XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1519 XINT (Vx_sensitive_text_pointer_shape
));
1522 hand_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_crosshair
);
1524 if (!NILP (Vx_window_horizontal_drag_shape
))
1526 CHECK_NUMBER (Vx_window_horizontal_drag_shape
);
1527 horizontal_drag_cursor
1528 = XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1529 XINT (Vx_window_horizontal_drag_shape
));
1532 horizontal_drag_cursor
1533 = XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_sb_h_double_arrow
);
1535 /* Check and report errors with the above calls. */
1536 x_check_errors (FRAME_W32_DISPLAY (f
), "can't set cursor shape: %s");
1537 x_uncatch_errors (FRAME_W32_DISPLAY (f
), count
);
1540 XColor fore_color
, back_color
;
1542 fore_color
.pixel
= f
->output_data
.w32
->mouse_pixel
;
1543 back_color
.pixel
= mask_color
;
1544 XQueryColor (FRAME_W32_DISPLAY (f
),
1545 DefaultColormap (FRAME_W32_DISPLAY (f
),
1546 DefaultScreen (FRAME_W32_DISPLAY (f
))),
1548 XQueryColor (FRAME_W32_DISPLAY (f
),
1549 DefaultColormap (FRAME_W32_DISPLAY (f
),
1550 DefaultScreen (FRAME_W32_DISPLAY (f
))),
1552 XRecolorCursor (FRAME_W32_DISPLAY (f
), cursor
,
1553 &fore_color
, &back_color
);
1554 XRecolorCursor (FRAME_W32_DISPLAY (f
), nontext_cursor
,
1555 &fore_color
, &back_color
);
1556 XRecolorCursor (FRAME_W32_DISPLAY (f
), mode_cursor
,
1557 &fore_color
, &back_color
);
1558 XRecolorCursor (FRAME_W32_DISPLAY (f
), hand_cursor
,
1559 &fore_color
, &back_color
);
1560 XRecolorCursor (FRAME_W32_DISPLAY (f
), hourglass_cursor
,
1561 &fore_color
, &back_color
);
1564 if (FRAME_W32_WINDOW (f
) != 0)
1565 XDefineCursor (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
), cursor
);
1567 if (cursor
!= f
->output_data
.w32
->text_cursor
&& f
->output_data
.w32
->text_cursor
!= 0)
1568 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->text_cursor
);
1569 f
->output_data
.w32
->text_cursor
= cursor
;
1571 if (nontext_cursor
!= f
->output_data
.w32
->nontext_cursor
1572 && f
->output_data
.w32
->nontext_cursor
!= 0)
1573 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->nontext_cursor
);
1574 f
->output_data
.w32
->nontext_cursor
= nontext_cursor
;
1576 if (hourglass_cursor
!= f
->output_data
.w32
->hourglass_cursor
1577 && f
->output_data
.w32
->hourglass_cursor
!= 0)
1578 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->hourglass_cursor
);
1579 f
->output_data
.w32
->hourglass_cursor
= hourglass_cursor
;
1581 if (mode_cursor
!= f
->output_data
.w32
->modeline_cursor
1582 && f
->output_data
.w32
->modeline_cursor
!= 0)
1583 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->modeline_cursor
);
1584 f
->output_data
.w32
->modeline_cursor
= mode_cursor
;
1586 if (hand_cursor
!= f
->output_data
.w32
->hand_cursor
1587 && f
->output_data
.w32
->hand_cursor
!= 0)
1588 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->hand_cursor
);
1589 f
->output_data
.w32
->hand_cursor
= hand_cursor
;
1591 XFlush (FRAME_W32_DISPLAY (f
));
1594 update_face_from_frame_parameter (f
, Qmouse_color
, arg
);
1595 #endif /* MAC_TODO */
1599 x_set_cursor_color (f
, arg
, oldval
)
1601 Lisp_Object arg
, oldval
;
1603 unsigned long fore_pixel
, pixel
;
1605 if (!NILP (Vx_cursor_fore_pixel
))
1606 fore_pixel
= x_decode_color (f
, Vx_cursor_fore_pixel
,
1607 WHITE_PIX_DEFAULT (f
));
1609 fore_pixel
= FRAME_BACKGROUND_PIXEL (f
);
1611 pixel
= x_decode_color (f
, arg
, BLACK_PIX_DEFAULT (f
));
1613 /* Make sure that the cursor color differs from the background color. */
1614 if (pixel
== FRAME_BACKGROUND_PIXEL (f
))
1616 pixel
= f
->output_data
.mac
->mouse_pixel
;
1617 if (pixel
== fore_pixel
)
1618 fore_pixel
= FRAME_BACKGROUND_PIXEL (f
);
1621 f
->output_data
.mac
->cursor_foreground_pixel
= fore_pixel
;
1622 f
->output_data
.mac
->cursor_pixel
= pixel
;
1624 if (FRAME_MAC_WINDOW (f
) != 0)
1627 /* Update frame's cursor_gc. */
1628 f
->output_data
.mac
->cursor_gc
->foreground
= fore_pixel
;
1629 f
->output_data
.mac
->cursor_gc
->background
= pixel
;
1633 if (FRAME_VISIBLE_P (f
))
1635 x_update_cursor (f
, 0);
1636 x_update_cursor (f
, 1);
1640 update_face_from_frame_parameter (f
, Qcursor_color
, arg
);
1643 /* Set the border-color of frame F to pixel value PIX.
1644 Note that this does not fully take effect if done before
1648 x_set_border_pixel (f
, pix
)
1653 f
->output_data
.mac
->border_pixel
= pix
;
1655 if (FRAME_MAC_WINDOW (f
) != 0 && f
->border_width
> 0)
1657 if (FRAME_VISIBLE_P (f
))
1662 /* Set the border-color of frame F to value described by ARG.
1663 ARG can be a string naming a color.
1664 The border-color is used for the border that is drawn by the server.
1665 Note that this does not fully take effect if done before
1666 F has a window; it must be redone when the window is created. */
1669 x_set_border_color (f
, arg
, oldval
)
1671 Lisp_Object arg
, oldval
;
1676 pix
= x_decode_color (f
, arg
, BLACK_PIX_DEFAULT (f
));
1677 x_set_border_pixel (f
, pix
);
1678 update_face_from_frame_parameter (f
, Qborder_color
, arg
);
1683 x_set_cursor_type (f
, arg
, oldval
)
1685 Lisp_Object arg
, oldval
;
1687 set_frame_cursor_types (f
, arg
);
1689 /* Make sure the cursor gets redrawn. */
1690 cursor_type_changed
= 1;
1693 #if 0 /* MAC_TODO: really no icon for Mac */
1695 x_set_icon_type (f
, arg
, oldval
)
1697 Lisp_Object arg
, oldval
;
1701 if (NILP (arg
) && NILP (oldval
))
1704 if (STRINGP (arg
) && STRINGP (oldval
)
1705 && EQ (Fstring_equal (oldval
, arg
), Qt
))
1708 if (SYMBOLP (arg
) && SYMBOLP (oldval
) && EQ (arg
, oldval
))
1713 result
= x_bitmap_icon (f
, arg
);
1717 error ("No icon window available");
1722 #endif /* MAC_TODO */
1725 x_set_icon_name (f
, arg
, oldval
)
1727 Lisp_Object arg
, oldval
;
1733 if (STRINGP (oldval
) && EQ (Fstring_equal (oldval
, arg
), Qt
))
1736 else if (!STRINGP (oldval
) && EQ (oldval
, Qnil
) == EQ (arg
, Qnil
))
1741 #if 0 /* MAC_TODO */
1742 if (f
->output_data
.w32
->icon_bitmap
!= 0)
1747 result
= x_text_icon (f
,
1748 (char *) SDATA ((!NILP (f
->icon_name
)
1757 error ("No icon window available");
1760 /* If the window was unmapped (and its icon was mapped),
1761 the new icon is not mapped, so map the window in its stead. */
1762 if (FRAME_VISIBLE_P (f
))
1764 #ifdef USE_X_TOOLKIT
1765 XtPopup (f
->output_data
.w32
->widget
, XtGrabNone
);
1767 XMapWindow (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
));
1770 XFlush (FRAME_W32_DISPLAY (f
));
1772 #endif /* MAC_TODO */
1777 x_set_menu_bar_lines (f
, value
, oldval
)
1779 Lisp_Object value
, oldval
;
1782 int olines
= FRAME_MENU_BAR_LINES (f
);
1784 /* Right now, menu bars don't work properly in minibuf-only frames;
1785 most of the commands try to apply themselves to the minibuffer
1786 frame itself, and get an error because you can't switch buffers
1787 in or split the minibuffer window. */
1788 if (FRAME_MINIBUF_ONLY_P (f
))
1791 if (INTEGERP (value
))
1792 nlines
= XINT (value
);
1796 FRAME_MENU_BAR_LINES (f
) = 0;
1798 FRAME_EXTERNAL_MENU_BAR (f
) = 1;
1801 if (FRAME_EXTERNAL_MENU_BAR (f
) == 1)
1802 free_frame_menubar (f
);
1803 FRAME_EXTERNAL_MENU_BAR (f
) = 0;
1805 /* Adjust the frame size so that the client (text) dimensions
1806 remain the same. This depends on FRAME_EXTERNAL_MENU_BAR being
1808 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
1809 do_pending_window_change (0);
1815 /* Set the number of lines used for the tool bar of frame F to VALUE.
1816 VALUE not an integer, or < 0 means set the lines to zero. OLDVAL
1817 is the old number of tool bar lines. This function changes the
1818 height of all windows on frame F to match the new tool bar height.
1819 The frame's height doesn't change. */
1822 x_set_tool_bar_lines (f
, value
, oldval
)
1824 Lisp_Object value
, oldval
;
1826 int delta
, nlines
, root_height
;
1827 Lisp_Object root_window
;
1829 /* Treat tool bars like menu bars. */
1830 if (FRAME_MINIBUF_ONLY_P (f
))
1833 /* Use VALUE only if an integer >= 0. */
1834 if (INTEGERP (value
) && XINT (value
) >= 0)
1835 nlines
= XFASTINT (value
);
1839 /* Make sure we redisplay all windows in this frame. */
1840 ++windows_or_buffers_changed
;
1842 delta
= nlines
- FRAME_TOOL_BAR_LINES (f
);
1844 /* Don't resize the tool-bar to more than we have room for. */
1845 root_window
= FRAME_ROOT_WINDOW (f
);
1846 root_height
= WINDOW_TOTAL_LINES (XWINDOW (root_window
));
1847 if (root_height
- delta
< 1)
1849 delta
= root_height
- 1;
1850 nlines
= FRAME_TOOL_BAR_LINES (f
) + delta
;
1853 FRAME_TOOL_BAR_LINES (f
) = nlines
;
1854 change_window_heights (root_window
, delta
);
1857 /* We also have to make sure that the internal border at the top of
1858 the frame, below the menu bar or tool bar, is redrawn when the
1859 tool bar disappears. This is so because the internal border is
1860 below the tool bar if one is displayed, but is below the menu bar
1861 if there isn't a tool bar. The tool bar draws into the area
1862 below the menu bar. */
1863 if (FRAME_MAC_WINDOW (f
) && FRAME_TOOL_BAR_LINES (f
) == 0)
1867 clear_current_matrices (f
);
1868 updating_frame
= NULL
;
1871 /* If the tool bar gets smaller, the internal border below it
1872 has to be cleared. It was formerly part of the display
1873 of the larger tool bar, and updating windows won't clear it. */
1876 int height
= FRAME_INTERNAL_BORDER_WIDTH (f
);
1877 int width
= FRAME_PIXEL_WIDTH (f
);
1878 int y
= nlines
* FRAME_LINE_HEIGHT (f
);
1881 XClearArea (FRAME_MAC_DISPLAY (f
), FRAME_MAC_WINDOW (f
),
1882 0, y
, width
, height
, 0);
1885 if (WINDOWP (f
->tool_bar_window
))
1886 clear_glyph_matrix (XWINDOW (f
->tool_bar_window
)->current_matrix
);
1891 /* Change the name of frame F to NAME. If NAME is nil, set F's name to
1894 If EXPLICIT is non-zero, that indicates that lisp code is setting the
1895 name; if NAME is a string, set F's name to NAME and set
1896 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
1898 If EXPLICIT is zero, that indicates that Emacs redisplay code is
1899 suggesting a new name, which lisp code should override; if
1900 F->explicit_name is set, ignore the new name; otherwise, set it. */
1903 x_set_name (f
, name
, explicit)
1908 /* Make sure that requests from lisp code override requests from
1909 Emacs redisplay code. */
1912 /* If we're switching from explicit to implicit, we had better
1913 update the mode lines and thereby update the title. */
1914 if (f
->explicit_name
&& NILP (name
))
1915 update_mode_lines
= 1;
1917 f
->explicit_name
= ! NILP (name
);
1919 else if (f
->explicit_name
)
1922 /* If NAME is nil, set the name to the w32_id_name. */
1925 /* Check for no change needed in this very common case
1926 before we do any consing. */
1927 if (!strcmp (FRAME_MAC_DISPLAY_INFO (f
)->mac_id_name
,
1930 name
= build_string (FRAME_MAC_DISPLAY_INFO (f
)->mac_id_name
);
1933 CHECK_STRING (name
);
1935 /* Don't change the name if it's already NAME. */
1936 if (! NILP (Fstring_equal (name
, f
->name
)))
1941 /* For setting the frame title, the title parameter should override
1942 the name parameter. */
1943 if (! NILP (f
->title
))
1946 if (FRAME_MAC_WINDOW (f
))
1948 if (STRING_MULTIBYTE (name
))
1949 #if 0 /* MAC_TODO: encoding title string */
1950 name
= ENCODE_SYSTEM (name
);
1959 if (strlen (SDATA (name
)) < 255)
1961 strcpy (windowTitle
, SDATA (name
));
1962 c2pstr (windowTitle
);
1963 SetWTitle (FRAME_MAC_WINDOW (f
), windowTitle
);
1971 /* This function should be called when the user's lisp code has
1972 specified a name for the frame; the name will override any set by the
1975 x_explicitly_set_name (f
, arg
, oldval
)
1977 Lisp_Object arg
, oldval
;
1979 x_set_name (f
, arg
, 1);
1982 /* This function should be called by Emacs redisplay code to set the
1983 name; names set this way will never override names set by the user's
1986 x_implicitly_set_name (f
, arg
, oldval
)
1988 Lisp_Object arg
, oldval
;
1990 x_set_name (f
, arg
, 0);
1993 /* Change the title of frame F to NAME.
1994 If NAME is nil, use the frame name as the title.
1996 If EXPLICIT is non-zero, that indicates that lisp code is setting the
1997 name; if NAME is a string, set F's name to NAME and set
1998 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
2000 If EXPLICIT is zero, that indicates that Emacs redisplay code is
2001 suggesting a new name, which lisp code should override; if
2002 F->explicit_name is set, ignore the new name; otherwise, set it. */
2005 x_set_title (f
, name
, old_name
)
2007 Lisp_Object name
, old_name
;
2009 /* Don't change the title if it's already NAME. */
2010 if (EQ (name
, f
->title
))
2013 update_mode_lines
= 1;
2020 if (FRAME_MAC_WINDOW (f
))
2022 if (STRING_MULTIBYTE (name
))
2023 #if 0 /* MAC_TODO: encoding title string */
2024 name
= ENCODE_SYSTEM (name
);
2033 if (strlen (SDATA (name
)) < 255)
2035 strcpy (windowTitle
, SDATA (name
));
2036 c2pstr (windowTitle
);
2037 SetWTitle (FRAME_MAC_WINDOW (f
), windowTitle
);
2046 x_set_scroll_bar_default_width (f
)
2049 /* Imitate X without X Toolkit */
2051 int wid
= FRAME_COLUMN_WIDTH (f
);
2054 FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) = 16; /* Aqua scroll bars. */
2055 FRAME_CONFIG_SCROLL_BAR_COLS (f
) = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) +
2057 #else /* not MAC_OSX */
2058 /* Make the actual width at least 14 pixels and a multiple of a
2060 FRAME_CONFIG_SCROLL_BAR_COLS (f
) = (14 + wid
- 1) / wid
;
2062 /* Use all of that space (aside from required margins) for the
2064 FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) = 0;
2065 #endif /* not MAC_OSX */
2069 /* Subroutines of creating a frame. */
2072 x_get_string_resource (rdb
, name
, class)
2076 /* MAC_TODO: implement resource strings */
2080 /* Return the value of parameter PARAM.
2082 First search ALIST, then Vdefault_frame_alist, then the X defaults
2083 database, using ATTRIBUTE as the attribute name and CLASS as its class.
2085 Convert the resource to the type specified by desired_type.
2087 If no default is specified, return Qunbound. If you call
2088 mac_get_arg, make sure you deal with Qunbound in a reasonable way,
2089 and don't let it get stored in any Lisp-visible variables! */
2092 mac_get_arg (alist
, param
, attribute
, class, type
)
2093 Lisp_Object alist
, param
;
2096 enum resource_types type
;
2098 return x_get_arg (check_x_display_info (Qnil
),
2099 alist
, param
, attribute
, class, type
);
2103 /* XParseGeometry copied from w32xfns.c */
2106 * XParseGeometry parses strings of the form
2107 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
2108 * width, height, xoffset, and yoffset are unsigned integers.
2109 * Example: "=80x24+300-49"
2110 * The equal sign is optional.
2111 * It returns a bitmask that indicates which of the four values
2112 * were actually found in the string. For each value found,
2113 * the corresponding argument is updated; for each value
2114 * not found, the corresponding argument is left unchanged.
2118 read_integer (string
, NextString
)
2119 register char *string
;
2122 register int Result
= 0;
2127 else if (*string
== '-')
2132 for (; (*string
>= '0') && (*string
<= '9'); string
++)
2134 Result
= (Result
* 10) + (*string
- '0');
2136 *NextString
= string
;
2144 XParseGeometry (string
, x
, y
, width
, height
)
2147 unsigned int *width
, *height
; /* RETURN */
2150 register char *strind
;
2151 unsigned int tempWidth
, tempHeight
;
2153 char *nextCharacter
;
2155 if ((string
== NULL
) || (*string
== '\0')) return (mask
);
2157 string
++; /* ignore possible '=' at beg of geometry spec */
2159 strind
= (char *)string
;
2160 if (*strind
!= '+' && *strind
!= '-' && *strind
!= 'x')
2162 tempWidth
= read_integer (strind
, &nextCharacter
);
2163 if (strind
== nextCharacter
)
2165 strind
= nextCharacter
;
2169 if (*strind
== 'x' || *strind
== 'X')
2172 tempHeight
= read_integer (strind
, &nextCharacter
);
2173 if (strind
== nextCharacter
)
2175 strind
= nextCharacter
;
2176 mask
|= HeightValue
;
2179 if ((*strind
== '+') || (*strind
== '-'))
2184 tempX
= -read_integer (strind
, &nextCharacter
);
2185 if (strind
== nextCharacter
)
2187 strind
= nextCharacter
;
2194 tempX
= read_integer (strind
, &nextCharacter
);
2195 if (strind
== nextCharacter
)
2197 strind
= nextCharacter
;
2200 if ((*strind
== '+') || (*strind
== '-'))
2205 tempY
= -read_integer (strind
, &nextCharacter
);
2206 if (strind
== nextCharacter
)
2208 strind
= nextCharacter
;
2215 tempY
= read_integer (strind
, &nextCharacter
);
2216 if (strind
== nextCharacter
)
2218 strind
= nextCharacter
;
2224 /* If strind isn't at the end of the string the it's an invalid
2225 geometry specification. */
2227 if (*strind
!= '\0') return (0);
2233 if (mask
& WidthValue
)
2235 if (mask
& HeightValue
)
2236 *height
= tempHeight
;
2241 #if 0 /* MAC_TODO */
2242 /* Create and set up the Mac window for frame F. */
2245 mac_window (f
, window_prompting
, minibuffer_only
)
2247 long window_prompting
;
2248 int minibuffer_only
;
2254 /* Use the resource name as the top-level window name
2255 for looking up resources. Make a non-Lisp copy
2256 for the window manager, so GC relocation won't bother it.
2258 Elsewhere we specify the window name for the window manager. */
2261 char *str
= (char *) SDATA (Vx_resource_name
);
2262 f
->namebuf
= (char *) xmalloc (strlen (str
) + 1);
2263 strcpy (f
->namebuf
, str
);
2266 SetRect (&r
, f
->left_pos
, f
->top_pos
,
2267 f
->left_pos
+ FRAME_PIXEL_WIDTH (f
),
2268 f
->top_pos
+ FRAME_PIXEL_HEIGHT (f
));
2269 FRAME_MAC_WINDOW (f
)
2270 = NewCWindow (NULL
, &r
, "\p", 1, zoomDocProc
, (WindowPtr
) -1, 1, (long) f
->output_data
.mac
);
2272 validate_x_resource_name ();
2274 /* x_set_name normally ignores requests to set the name if the
2275 requested name is the same as the current name. This is the one
2276 place where that assumption isn't correct; f->name is set, but
2277 the server hasn't been told. */
2280 int explicit = f
->explicit_name
;
2282 f
->explicit_name
= 0;
2285 x_set_name (f
, name
, explicit);
2288 ShowWindow (FRAME_MAC_WINDOW (f
));
2292 if (!minibuffer_only
&& FRAME_EXTERNAL_MENU_BAR (f
))
2293 initialize_frame_menubar (f
);
2295 if (FRAME_MAC_WINDOW (f
) == 0)
2296 error ("Unable to create window");
2298 #endif /* MAC_TODO */
2300 /* Handle the icon stuff for this window. Perhaps later we might
2301 want an x_set_icon_position which can be called interactively as
2309 Lisp_Object icon_x
, icon_y
;
2311 /* Set the position of the icon. Note that Windows 95 groups all
2312 icons in the tray. */
2313 icon_x
= mac_get_arg (parms
, Qicon_left
, 0, 0, RES_TYPE_NUMBER
);
2314 icon_y
= mac_get_arg (parms
, Qicon_top
, 0, 0, RES_TYPE_NUMBER
);
2315 if (!EQ (icon_x
, Qunbound
) && !EQ (icon_y
, Qunbound
))
2317 CHECK_NUMBER (icon_x
);
2318 CHECK_NUMBER (icon_y
);
2320 else if (!EQ (icon_x
, Qunbound
) || !EQ (icon_y
, Qunbound
))
2321 error ("Both left and top icon corners of icon must be specified");
2325 if (! EQ (icon_x
, Qunbound
))
2326 x_wm_set_icon_position (f
, XINT (icon_x
), XINT (icon_y
));
2329 /* Start up iconic or window? */
2330 x_wm_set_window_state
2331 (f
, (EQ (w32_get_arg (parms
, Qvisibility
, 0, 0, RES_TYPE_SYMBOL
), Qicon
)
2335 x_text_icon (f
, (char *) SDATA ((!NILP (f
->icon_name
)
2348 XGCValues gc_values
;
2352 /* Create the GCs of this frame.
2353 Note that many default values are used. */
2356 gc_values
.font
= FRAME_FONT (f
);
2357 gc_values
.foreground
= FRAME_FOREGROUND_PIXEL (f
);
2358 gc_values
.background
= FRAME_BACKGROUND_PIXEL (f
);
2359 f
->output_data
.mac
->normal_gc
= XCreateGC (FRAME_MAC_DISPLAY (f
),
2360 FRAME_MAC_WINDOW (f
),
2361 GCFont
| GCForeground
| GCBackground
,
2364 /* Reverse video style. */
2365 gc_values
.foreground
= FRAME_BACKGROUND_PIXEL (f
);
2366 gc_values
.background
= FRAME_FOREGROUND_PIXEL (f
);
2367 f
->output_data
.mac
->reverse_gc
= XCreateGC (FRAME_MAC_DISPLAY (f
),
2368 FRAME_MAC_WINDOW (f
),
2369 GCFont
| GCForeground
| GCBackground
,
2372 /* Cursor has cursor-color background, background-color foreground. */
2373 gc_values
.foreground
= FRAME_BACKGROUND_PIXEL (f
);
2374 gc_values
.background
= f
->output_data
.mac
->cursor_pixel
;
2375 f
->output_data
.mac
->cursor_gc
= XCreateGC (FRAME_MAC_DISPLAY (f
),
2376 FRAME_MAC_WINDOW (f
),
2377 GCFont
| GCForeground
| GCBackground
,
2381 f
->output_data
.mac
->white_relief
.gc
= 0;
2382 f
->output_data
.mac
->black_relief
.gc
= 0;
2385 /* Create the gray border tile used when the pointer is not in
2386 the frame. Since this depends on the frame's pixel values,
2387 this must be done on a per-frame basis. */
2388 f
->output_data
.x
->border_tile
2389 = (XCreatePixmapFromBitmapData
2390 (FRAME_X_DISPLAY (f
), FRAME_X_DISPLAY_INFO (f
)->root_window
,
2391 gray_bits
, gray_width
, gray_height
,
2392 f
->output_data
.x
->foreground_pixel
,
2393 f
->output_data
.x
->background_pixel
,
2394 DefaultDepth (FRAME_X_DISPLAY (f
), FRAME_X_SCREEN_NUMBER (f
))));
2401 /* Free what was was allocated in x_make_gc. */
2407 Display
*dpy
= FRAME_MAC_DISPLAY (f
);
2411 if (f
->output_data
.mac
->normal_gc
)
2413 XFreeGC (dpy
, f
->output_data
.mac
->normal_gc
);
2414 f
->output_data
.mac
->normal_gc
= 0;
2417 if (f
->output_data
.mac
->reverse_gc
)
2419 XFreeGC (dpy
, f
->output_data
.mac
->reverse_gc
);
2420 f
->output_data
.mac
->reverse_gc
= 0;
2423 if (f
->output_data
.mac
->cursor_gc
)
2425 XFreeGC (dpy
, f
->output_data
.mac
->cursor_gc
);
2426 f
->output_data
.mac
->cursor_gc
= 0;
2430 if (f
->output_data
.mac
->border_tile
)
2432 XFreePixmap (dpy
, f
->output_data
.mac
->border_tile
);
2433 f
->output_data
.mac
->border_tile
= 0;
2437 if (f
->output_data
.mac
->white_relief
.gc
)
2439 XFreeGC (dpy
, f
->output_data
.mac
->white_relief
.gc
);
2440 f
->output_data
.mac
->white_relief
.gc
= 0;
2443 if (f
->output_data
.mac
->black_relief
.gc
)
2445 XFreeGC (dpy
, f
->output_data
.mac
->black_relief
.gc
);
2446 f
->output_data
.mac
->black_relief
.gc
= 0;
2453 /* Handler for signals raised during x_create_frame and
2454 x_create_top_frame. FRAME is the frame which is partially
2458 unwind_create_frame (frame
)
2461 struct frame
*f
= XFRAME (frame
);
2463 /* If frame is ``official'', nothing to do. */
2464 if (!CONSP (Vframe_list
) || !EQ (XCAR (Vframe_list
), frame
))
2467 struct x_display_info
*dpyinfo
= FRAME_X_DISPLAY_INFO (f
);
2470 x_free_frame_resources (f
);
2472 /* Check that reference counts are indeed correct. */
2473 xassert (dpyinfo
->reference_count
== dpyinfo_refcount
);
2474 xassert (dpyinfo
->image_cache
->refcount
== image_cache_refcount
);
2482 DEFUN ("x-create-frame", Fx_create_frame
, Sx_create_frame
,
2484 doc
: /* Make a new window, which is called a \"frame\" in Emacs terms.
2485 Returns an Emacs frame object.
2486 ALIST is an alist of frame parameters.
2487 If the parameters specify that the frame should not have a minibuffer,
2488 and do not specify a specific minibuffer window to use,
2489 then `default-minibuffer-frame' must be a frame whose minibuffer can
2490 be shared by the new frame.
2492 This function is an internal primitive--use `make-frame' instead. */)
2497 Lisp_Object frame
, tem
;
2499 int minibuffer_only
= 0;
2500 long window_prompting
= 0;
2502 int count
= SPECPDL_INDEX ();
2503 struct gcpro gcpro1
, gcpro2
, gcpro3
, gcpro4
;
2504 Lisp_Object display
;
2505 struct mac_display_info
*dpyinfo
= NULL
;
2508 char x_frame_name
[10];
2509 static int x_frame_count
= 2; /* begins at 2 because terminal frame is F1 */
2513 /* Use this general default value to start with
2514 until we know if this frame has a specified name. */
2515 Vx_resource_name
= Vinvocation_name
;
2517 display
= mac_get_arg (parms
, Qdisplay
, 0, 0, RES_TYPE_STRING
);
2518 if (EQ (display
, Qunbound
))
2520 dpyinfo
= check_x_display_info (display
);
2522 kb
= dpyinfo
->kboard
;
2524 kb
= &the_only_kboard
;
2527 name
= mac_get_arg (parms
, Qname
, "name", "Name", RES_TYPE_STRING
);
2529 && ! EQ (name
, Qunbound
)
2531 error ("Invalid frame name--not a string or nil");
2534 Vx_resource_name
= name
;
2536 /* See if parent window is specified. */
2537 parent
= mac_get_arg (parms
, Qparent_id
, NULL
, NULL
, RES_TYPE_NUMBER
);
2538 if (EQ (parent
, Qunbound
))
2540 if (! NILP (parent
))
2541 CHECK_NUMBER (parent
);
2543 /* make_frame_without_minibuffer can run Lisp code and garbage collect. */
2544 /* No need to protect DISPLAY because that's not used after passing
2545 it to make_frame_without_minibuffer. */
2547 GCPRO4 (parms
, parent
, name
, frame
);
2548 tem
= mac_get_arg (parms
, Qminibuffer
, "minibuffer", "Minibuffer",
2550 if (EQ (tem
, Qnone
) || NILP (tem
))
2551 f
= make_frame_without_minibuffer (Qnil
, kb
, display
);
2552 else if (EQ (tem
, Qonly
))
2554 f
= make_minibuffer_frame ();
2555 minibuffer_only
= 1;
2557 else if (WINDOWP (tem
))
2558 f
= make_frame_without_minibuffer (tem
, kb
, display
);
2562 if (EQ (name
, Qunbound
) || NILP (name
))
2564 sprintf (x_frame_name
, "F%d", x_frame_count
++);
2565 f
->name
= build_string (x_frame_name
);
2566 f
->explicit_name
= 0;
2571 f
->explicit_name
= 1;
2574 XSETFRAME (frame
, f
);
2576 /* Note that X Windows does support scroll bars. */
2577 FRAME_CAN_HAVE_SCROLL_BARS (f
) = 1;
2579 f
->output_method
= output_mac
;
2580 f
->output_data
.mac
= (struct mac_output
*) xmalloc (sizeof (struct mac_output
));
2581 bzero (f
->output_data
.mac
, sizeof (struct mac_output
));
2582 FRAME_FONTSET (f
) = -1;
2583 f
->output_data
.mac
->scroll_bar_foreground_pixel
= -1;
2584 f
->output_data
.mac
->scroll_bar_background_pixel
= -1;
2585 record_unwind_protect (unwind_create_frame
, frame
);
2588 = mac_get_arg (parms
, Qicon_name
, "iconName", "Title", RES_TYPE_STRING
);
2589 if (! STRINGP (f
->icon_name
))
2590 f
->icon_name
= Qnil
;
2592 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
2594 FRAME_KBOARD (f
) = kb
;
2597 /* Specify the parent under which to make this window. */
2601 f
->output_data
.mac
->parent_desc
= (Window
) parent
;
2602 f
->output_data
.mac
->explicit_parent
= 1;
2606 f
->output_data
.mac
->parent_desc
= FRAME_MAC_DISPLAY_INFO (f
)->root_window
;
2607 f
->output_data
.mac
->explicit_parent
= 0;
2610 /* Set the name; the functions to which we pass f expect the name to
2612 if (EQ (name
, Qunbound
) || NILP (name
))
2614 f
->name
= build_string (dpyinfo
->mac_id_name
);
2615 f
->explicit_name
= 0;
2620 f
->explicit_name
= 1;
2621 /* use the frame's title when getting resources for this frame. */
2622 specbind (Qx_resource_name
, name
);
2625 /* Extract the window parameters from the supplied values
2626 that are needed to determine window geometry. */
2630 font
= mac_get_arg (parms
, Qfont
, "font", "Font", RES_TYPE_STRING
);
2633 /* First, try whatever font the caller has specified. */
2636 tem
= Fquery_fontset (font
, Qnil
);
2638 font
= x_new_fontset (f
, SDATA (tem
));
2640 font
= x_new_font (f
, SDATA (font
));
2643 /* Try out a font which we hope has bold and italic variations. */
2644 if (! STRINGP (font
))
2645 font
= x_new_font (f
, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1");
2646 /* If those didn't work, look for something which will at least work. */
2647 if (! STRINGP (font
))
2648 font
= x_new_font (f
, "-*-monaco-*-12-*-mac-roman");
2649 if (! STRINGP (font
))
2650 font
= x_new_font (f
, "-*-courier-*-10-*-mac-roman");
2651 if (! STRINGP (font
))
2652 error ("Cannot find any usable font");
2655 x_default_parameter (f
, parms
, Qfont
, font
,
2656 "font", "Font", RES_TYPE_STRING
);
2659 x_default_parameter (f
, parms
, Qborder_width
, make_number (0),
2660 "borderwidth", "BorderWidth", RES_TYPE_NUMBER
);
2661 /* This defaults to 2 in order to match xterm. We recognize either
2662 internalBorderWidth or internalBorder (which is what xterm calls
2664 if (NILP (Fassq (Qinternal_border_width
, parms
)))
2668 value
= mac_get_arg (parms
, Qinternal_border_width
,
2669 "internalBorder", "InternalBorder", RES_TYPE_NUMBER
);
2670 if (! EQ (value
, Qunbound
))
2671 parms
= Fcons (Fcons (Qinternal_border_width
, value
),
2674 /* Default internalBorderWidth to 0 on Windows to match other programs. */
2675 x_default_parameter (f
, parms
, Qinternal_border_width
, make_number (0),
2676 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER
);
2677 x_default_parameter (f
, parms
, Qvertical_scroll_bars
, Qright
,
2678 "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL
);
2680 /* Also do the stuff which must be set before the window exists. */
2681 x_default_parameter (f
, parms
, Qforeground_color
, build_string ("black"),
2682 "foreground", "Foreground", RES_TYPE_STRING
);
2683 x_default_parameter (f
, parms
, Qbackground_color
, build_string ("white"),
2684 "background", "Background", RES_TYPE_STRING
);
2685 x_default_parameter (f
, parms
, Qmouse_color
, build_string ("black"),
2686 "pointerColor", "Foreground", RES_TYPE_STRING
);
2687 x_default_parameter (f
, parms
, Qcursor_color
, build_string ("black"),
2688 "cursorColor", "Foreground", RES_TYPE_STRING
);
2689 x_default_parameter (f
, parms
, Qborder_color
, build_string ("black"),
2690 "borderColor", "BorderColor", RES_TYPE_STRING
);
2691 x_default_parameter (f
, parms
, Qscreen_gamma
, Qnil
,
2692 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT
);
2693 x_default_parameter (f
, parms
, Qline_spacing
, Qnil
,
2694 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER
);
2695 x_default_parameter (f
, parms
, Qleft_fringe
, Qnil
,
2696 "leftFringe", "LeftFringe", RES_TYPE_NUMBER
);
2697 x_default_parameter (f
, parms
, Qright_fringe
, Qnil
,
2698 "rightFringe", "RightFringe", RES_TYPE_NUMBER
);
2701 /* Init faces before x_default_parameter is called for scroll-bar
2702 parameters because that function calls x_set_scroll_bar_width,
2703 which calls change_frame_size, which calls Fset_window_buffer,
2704 which runs hooks, which call Fvertical_motion. At the end, we
2705 end up in init_iterator with a null face cache, which should not
2707 init_frame_faces (f
);
2709 x_default_parameter (f
, parms
, Qmenu_bar_lines
, make_number (1),
2710 "menuBar", "MenuBar", RES_TYPE_NUMBER
);
2711 x_default_parameter (f
, parms
, Qtool_bar_lines
, make_number (0),
2712 "toolBar", "ToolBar", RES_TYPE_NUMBER
);
2713 x_default_parameter (f
, parms
, Qbuffer_predicate
, Qnil
,
2714 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL
);
2715 x_default_parameter (f
, parms
, Qtitle
, Qnil
,
2716 "title", "Title", RES_TYPE_STRING
);
2718 f
->output_data
.mac
->parent_desc
= FRAME_MAC_DISPLAY_INFO (f
)->root_window
;
2720 /* MAC_TODO: specify 1 below when toolbars are implemented. */
2721 window_prompting
= x_figure_window_size (f
, parms
, 0);
2723 tem
= mac_get_arg (parms
, Qunsplittable
, 0, 0, RES_TYPE_BOOLEAN
);
2724 f
->no_split
= minibuffer_only
|| EQ (tem
, Qt
);
2726 /* Create the window. Add the tool-bar height to the initial frame
2727 height so that the user gets a text display area of the size he
2728 specified with -g or via the registry. Later changes of the
2729 tool-bar height don't change the frame size. This is done so that
2730 users can create tall Emacs frames without having to guess how
2731 tall the tool-bar will get. */
2732 FRAME_LINES (f
) += FRAME_TOOL_BAR_LINES (f
);
2734 /* mac_window (f, window_prompting, minibuffer_only); */
2741 /* Now consider the frame official. */
2742 FRAME_MAC_DISPLAY_INFO (f
)->reference_count
++;
2743 Vframe_list
= Fcons (frame
, Vframe_list
);
2745 /* We need to do this after creating the window, so that the
2746 icon-creation functions can say whose icon they're describing. */
2747 x_default_parameter (f
, parms
, Qicon_type
, Qnil
,
2748 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL
);
2750 x_default_parameter (f
, parms
, Qauto_raise
, Qnil
,
2751 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN
);
2752 x_default_parameter (f
, parms
, Qauto_lower
, Qnil
,
2753 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN
);
2754 x_default_parameter (f
, parms
, Qcursor_type
, Qbox
,
2755 "cursorType", "CursorType", RES_TYPE_SYMBOL
);
2756 x_default_parameter (f
, parms
, Qscroll_bar_width
, Qnil
,
2757 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER
);
2759 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
2760 Change will not be effected unless different from the current
2762 width
= FRAME_COLS (f
);
2763 height
= FRAME_LINES (f
);
2765 FRAME_LINES (f
) = 0;
2766 SET_FRAME_COLS (f
, 0);
2767 change_frame_size (f
, height
, width
, 1, 0, 0);
2769 /* Set up faces after all frame parameters are known. */
2770 call1 (Qface_set_after_frame_default
, frame
);
2772 #if 0 /* MAC_TODO: when we have window manager hints */
2773 /* Tell the server what size and position, etc, we want, and how
2774 badly we want them. This should be done after we have the menu
2775 bar so that its size can be taken into account. */
2777 x_wm_set_size_hint (f
, window_prompting
, 0);
2781 /* Make the window appear on the frame and enable display, unless
2782 the caller says not to. However, with explicit parent, Emacs
2783 cannot control visibility, so don't try. */
2784 if (! f
->output_data
.mac
->explicit_parent
)
2786 Lisp_Object visibility
;
2788 visibility
= mac_get_arg (parms
, Qvisibility
, 0, 0, RES_TYPE_SYMBOL
);
2789 if (EQ (visibility
, Qunbound
))
2792 #if 0 /* MAC_TODO: really no iconify on Mac */
2793 if (EQ (visibility
, Qicon
))
2794 x_iconify_frame (f
);
2797 if (! NILP (visibility
))
2798 x_make_frame_visible (f
);
2800 /* Must have been Qnil. */
2805 /* Make sure windows on this frame appear in calls to next-window
2806 and similar functions. */
2807 Vwindow_list
= Qnil
;
2809 return unbind_to (count
, frame
);
2812 /* FRAME is used only to get a handle on the X display. We don't pass the
2813 display info directly because we're called from frame.c, which doesn't
2814 know about that structure. */
2816 x_get_focus_frame (frame
)
2817 struct frame
*frame
;
2819 struct mac_display_info
*dpyinfo
= FRAME_MAC_DISPLAY_INFO (frame
);
2821 if (! dpyinfo
->x_focus_frame
)
2824 XSETFRAME (xfocus
, dpyinfo
->x_focus_frame
);
2828 DEFUN ("xw-color-defined-p", Fxw_color_defined_p
, Sxw_color_defined_p
, 1, 2, 0,
2829 doc
: /* Internal function called by `color-defined-p', which see. */)
2831 Lisp_Object color
, frame
;
2834 FRAME_PTR f
= check_x_frame (frame
);
2836 CHECK_STRING (color
);
2838 if (mac_defined_color (f
, SDATA (color
), &foo
, 0))
2844 DEFUN ("xw-color-values", Fxw_color_values
, Sxw_color_values
, 1, 2, 0,
2845 doc
: /* Internal function called by `color-values', which see. */)
2847 Lisp_Object color
, frame
;
2850 FRAME_PTR f
= check_x_frame (frame
);
2852 CHECK_STRING (color
);
2854 if (mac_defined_color (f
, SDATA (color
), &foo
, 0))
2858 rgb
[0] = make_number (foo
.red
);
2859 rgb
[1] = make_number (foo
.green
);
2860 rgb
[2] = make_number (foo
.blue
);
2861 return Flist (3, rgb
);
2867 DEFUN ("xw-display-color-p", Fxw_display_color_p
, Sxw_display_color_p
, 0, 1, 0,
2868 doc
: /* Internal function called by `display-color-p', which see. */)
2870 Lisp_Object display
;
2872 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2874 if (!dpyinfo
->color_p
)
2880 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p
, Sx_display_grayscale_p
,
2882 doc
: /* Return t if the X display supports shades of gray.
2883 Note that color displays do support shades of gray.
2884 The optional argument DISPLAY specifies which display to ask about.
2885 DISPLAY should be either a frame or a display name (a string).
2886 If omitted or nil, that stands for the selected frame's display. */)
2888 Lisp_Object display
;
2890 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2892 if (dpyinfo
->n_planes
<= 1)
2898 DEFUN ("x-display-pixel-width", Fx_display_pixel_width
, Sx_display_pixel_width
,
2900 doc
: /* Returns the width in pixels of the X display DISPLAY.
2901 The optional argument DISPLAY specifies which display to ask about.
2902 DISPLAY should be either a frame or a display name (a string).
2903 If omitted or nil, that stands for the selected frame's display. */)
2905 Lisp_Object display
;
2907 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2909 return make_number (dpyinfo
->width
);
2912 DEFUN ("x-display-pixel-height", Fx_display_pixel_height
,
2913 Sx_display_pixel_height
, 0, 1, 0,
2914 doc
: /* Returns the height in pixels of the X display DISPLAY.
2915 The optional argument DISPLAY specifies which display to ask about.
2916 DISPLAY should be either a frame or a display name (a string).
2917 If omitted or nil, that stands for the selected frame's display. */)
2919 Lisp_Object display
;
2921 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2923 return make_number (dpyinfo
->height
);
2926 DEFUN ("x-display-planes", Fx_display_planes
, Sx_display_planes
,
2928 doc
: /* Returns the number of bitplanes of the display DISPLAY.
2929 The optional argument DISPLAY specifies which display to ask about.
2930 DISPLAY should be either a frame or a display name (a string).
2931 If omitted or nil, that stands for the selected frame's display. */)
2933 Lisp_Object display
;
2935 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2937 return make_number (dpyinfo
->n_planes
);
2940 DEFUN ("x-display-color-cells", Fx_display_color_cells
, Sx_display_color_cells
,
2942 doc
: /* Returns the number of color cells of the display DISPLAY.
2943 The optional argument DISPLAY specifies which display to ask about.
2944 DISPLAY should be either a frame or a display name (a string).
2945 If omitted or nil, that stands for the selected frame's display. */)
2947 Lisp_Object display
;
2949 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2951 /* MAC_TODO: check whether this is right */
2952 return make_number (dpyinfo
->n_planes
>= 8 ? 256 : 1 << dpyinfo
->n_planes
- 1);
2955 DEFUN ("x-server-max-request-size", Fx_server_max_request_size
,
2956 Sx_server_max_request_size
,
2958 doc
: /* Returns the maximum request size of the server of display DISPLAY.
2959 The optional argument DISPLAY specifies which display to ask about.
2960 DISPLAY should be either a frame or a display name (a string).
2961 If omitted or nil, that stands for the selected frame's display. */)
2963 Lisp_Object display
;
2965 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2967 return make_number (1);
2970 DEFUN ("x-server-vendor", Fx_server_vendor
, Sx_server_vendor
, 0, 1, 0,
2971 doc
: /* Returns the vendor ID string of the Mac OS system (Apple).
2972 The optional argument DISPLAY specifies which display to ask about.
2973 DISPLAY should be either a frame or a display name (a string).
2974 If omitted or nil, that stands for the selected frame's display. */)
2976 Lisp_Object display
;
2978 return build_string ("Apple Computers");
2981 DEFUN ("x-server-version", Fx_server_version
, Sx_server_version
, 0, 1, 0,
2982 doc
: /* Returns the version numbers of the server of display DISPLAY.
2983 The value is a list of three integers: the major and minor
2984 version numbers, and the vendor-specific release
2985 number. See also the function `x-server-vendor'.
2987 The optional argument DISPLAY specifies which display to ask about.
2988 DISPLAY should be either a frame or a display name (a string).
2989 If omitted or nil, that stands for the selected frame's display. */)
2991 Lisp_Object display
;
2993 int mac_major_version
, mac_minor_version
;
2996 if (Gestalt (gestaltSystemVersion
, &response
) != noErr
)
2997 error ("Cannot get Mac OS version");
2999 mac_major_version
= (response
>> 8) & 0xf;
3000 mac_minor_version
= (response
>> 4) & 0xf;
3002 return Fcons (make_number (mac_major_version
),
3003 Fcons (make_number (mac_minor_version
), Qnil
));
3006 DEFUN ("x-display-screens", Fx_display_screens
, Sx_display_screens
, 0, 1, 0,
3007 doc
: /* Return the number of screens on the server of display DISPLAY.
3008 The optional argument DISPLAY specifies which display to ask about.
3009 DISPLAY should be either a frame or a display name (a string).
3010 If omitted or nil, that stands for the selected frame's display. */)
3012 Lisp_Object display
;
3014 return make_number (1);
3017 DEFUN ("x-display-mm-height", Fx_display_mm_height
, Sx_display_mm_height
, 0, 1, 0,
3018 doc
: /* Return the height in millimeters of the X display DISPLAY.
3019 The optional argument DISPLAY specifies which display to ask about.
3020 DISPLAY should be either a frame or a display name (a string).
3021 If omitted or nil, that stands for the selected frame's display. */)
3023 Lisp_Object display
;
3025 /* MAC_TODO: this is an approximation, and only of the main display */
3027 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
3032 return make_number ((int) (v
/ 72.0 * 25.4));
3035 DEFUN ("x-display-mm-width", Fx_display_mm_width
, Sx_display_mm_width
, 0, 1, 0,
3036 doc
: /* Return the width in millimeters of the X display DISPLAY.
3037 The optional argument DISPLAY specifies which display to ask about.
3038 DISPLAY should be either a frame or a display name (a string).
3039 If omitted or nil, that stands for the selected frame's display. */)
3041 Lisp_Object display
;
3043 /* MAC_TODO: this is an approximation, and only of the main display */
3045 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
3050 return make_number ((int) (h
/ 72.0 * 25.4));
3053 DEFUN ("x-display-backing-store", Fx_display_backing_store
,
3054 Sx_display_backing_store
, 0, 1, 0,
3055 doc
: /* Returns an indication of whether display DISPLAY does backing store.
3056 The value may be `always', `when-mapped', or `not-useful'.
3057 The optional argument DISPLAY specifies which display to ask about.
3058 DISPLAY should be either a frame or a display name (a string).
3059 If omitted or nil, that stands for the selected frame's display. */)
3061 Lisp_Object display
;
3063 return intern ("not-useful");
3066 DEFUN ("x-display-visual-class", Fx_display_visual_class
,
3067 Sx_display_visual_class
, 0, 1, 0,
3068 doc
: /* Returns the visual class of the display DISPLAY.
3069 The value is one of the symbols `static-gray', `gray-scale',
3070 `static-color', `pseudo-color', `true-color', or `direct-color'.
3072 The optional argument DISPLAY specifies which display to ask about.
3073 DISPLAY should be either a frame or a display name (a string).
3074 If omitted or nil, that stands for the selected frame's display. */)
3076 Lisp_Object display
;
3078 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
3081 switch (dpyinfo
->visual
->class)
3083 case StaticGray
: return (intern ("static-gray"));
3084 case GrayScale
: return (intern ("gray-scale"));
3085 case StaticColor
: return (intern ("static-color"));
3086 case PseudoColor
: return (intern ("pseudo-color"));
3087 case TrueColor
: return (intern ("true-color"));
3088 case DirectColor
: return (intern ("direct-color"));
3090 error ("Display has an unknown visual class");
3094 return (intern ("true-color"));
3097 DEFUN ("x-display-save-under", Fx_display_save_under
,
3098 Sx_display_save_under
, 0, 1, 0,
3099 doc
: /* Returns t if the display DISPLAY supports the save-under feature.
3100 The optional argument DISPLAY specifies which display to ask about.
3101 DISPLAY should be either a frame or a display name (a string).
3102 If omitted or nil, that stands for the selected frame's display. */)
3104 Lisp_Object display
;
3111 register struct frame
*f
;
3113 return FRAME_PIXEL_WIDTH (f
);
3118 register struct frame
*f
;
3120 return FRAME_PIXEL_HEIGHT (f
);
3125 register struct frame
*f
;
3127 return FRAME_COLUMN_WIDTH (f
);
3132 register struct frame
*f
;
3134 return FRAME_LINE_HEIGHT (f
);
3139 register struct frame
*f
;
3141 return FRAME_MAC_DISPLAY_INFO (f
)->n_planes
;
3144 /* Return the display structure for the display named NAME.
3145 Open a new connection if necessary. */
3147 struct mac_display_info
*
3148 x_display_info_for_name (name
)
3152 struct mac_display_info
*dpyinfo
;
3154 CHECK_STRING (name
);
3156 for (dpyinfo
= &one_mac_display_info
, names
= x_display_name_list
;
3158 dpyinfo
= dpyinfo
->next
, names
= XCDR (names
))
3161 tem
= Fstring_equal (XCAR (XCAR (names
)), name
);
3166 /* Use this general default value to start with. */
3167 Vx_resource_name
= Vinvocation_name
;
3169 validate_x_resource_name ();
3171 dpyinfo
= mac_term_init (name
, (unsigned char *) 0,
3172 (char *) SDATA (Vx_resource_name
));
3175 error ("Cannot connect to server %s", SDATA (name
));
3178 XSETFASTINT (Vwindow_system_version
, 3);
3183 #if 0 /* MAC_TODO: implement network support */
3184 DEFUN ("x-open-connection", Fx_open_connection
, Sx_open_connection
,
3186 doc
: /* Open a connection to a server.
3187 DISPLAY is the name of the display to connect to.
3188 Optional second arg XRM-STRING is a string of resources in xrdb format.
3189 If the optional third arg MUST-SUCCEED is non-nil,
3190 terminate Emacs if we can't open the connection. */)
3191 (display
, xrm_string
, must_succeed
)
3192 Lisp_Object display
, xrm_string
, must_succeed
;
3194 unsigned char *xrm_option
;
3195 struct mac_display_info
*dpyinfo
;
3197 CHECK_STRING (display
);
3198 if (! NILP (xrm_string
))
3199 CHECK_STRING (xrm_string
);
3201 if (! EQ (Vwindow_system
, intern ("mac")))
3202 error ("Not using Mac OS");
3204 if (! NILP (xrm_string
))
3205 xrm_option
= (unsigned char *) SDATA (xrm_string
);
3207 xrm_option
= (unsigned char *) 0;
3209 validate_x_resource_name ();
3211 /* This is what opens the connection and sets x_current_display.
3212 This also initializes many symbols, such as those used for input. */
3213 dpyinfo
= mac_term_init (display
, xrm_option
,
3214 (char *) SDATA (Vx_resource_name
));
3218 if (!NILP (must_succeed
))
3219 fatal ("Cannot connect to server %s.\n",
3222 error ("Cannot connect to server %s", SDATA (display
));
3227 XSETFASTINT (Vwindow_system_version
, 3);
3231 DEFUN ("x-close-connection", Fx_close_connection
,
3232 Sx_close_connection
, 1, 1, 0,
3233 doc
: /* Close the connection to DISPLAY's server.
3234 For DISPLAY, specify either a frame or a display name (a string).
3235 If DISPLAY is nil, that stands for the selected frame's display. */)
3237 Lisp_Object display
;
3239 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
3242 if (dpyinfo
->reference_count
> 0)
3243 error ("Display still has frames on it");
3246 /* Free the fonts in the font table. */
3247 for (i
= 0; i
< dpyinfo
->n_fonts
; i
++)
3248 if (dpyinfo
->font_table
[i
].name
)
3250 if (dpyinfo
->font_table
[i
].name
!= dpyinfo
->font_table
[i
].full_name
)
3251 xfree (dpyinfo
->font_table
[i
].full_name
);
3252 xfree (dpyinfo
->font_table
[i
].name
);
3253 x_unload_font (dpyinfo
, dpyinfo
->font_table
[i
].font
);
3255 x_destroy_all_bitmaps (dpyinfo
);
3257 x_delete_display (dpyinfo
);
3264 DEFUN ("x-display-list", Fx_display_list
, Sx_display_list
, 0, 0, 0,
3265 doc
: /* Return the list of display names that Emacs has connections to. */)
3268 Lisp_Object tail
, result
;
3271 for (tail
= x_display_name_list
; ! NILP (tail
); tail
= XCDR (tail
))
3272 result
= Fcons (XCAR (XCAR (tail
)), result
);
3277 DEFUN ("x-synchronize", Fx_synchronize
, Sx_synchronize
, 1, 2, 0,
3278 doc
: /* If ON is non-nil, report errors as soon as the erring request is made.
3279 If ON is nil, allow buffering of requests.
3280 This is a noop on Mac OS systems.
3281 The optional second argument DISPLAY specifies which display to act on.
3282 DISPLAY should be either a frame or a display name (a string).
3283 If DISPLAY is omitted or nil, that stands for the selected frame's display. */)
3285 Lisp_Object display
, on
;
3291 /***********************************************************************
3293 ***********************************************************************/
3295 DEFUN ("x-change-window-property", Fx_change_window_property
,
3296 Sx_change_window_property
, 2, 6, 0,
3297 doc
: /* Change window property PROP to VALUE on the X window of FRAME.
3298 VALUE may be a string or a list of conses, numbers and/or strings.
3299 If an element in the list is a string, it is converted to
3300 an Atom and the value of the Atom is used. If an element is a cons,
3301 it is converted to a 32 bit number where the car is the 16 top bits and the
3302 cdr is the lower 16 bits.
3303 FRAME nil or omitted means use the selected frame.
3304 If TYPE is given and non-nil, it is the name of the type of VALUE.
3305 If TYPE is not given or nil, the type is STRING.
3306 FORMAT gives the size in bits of each element if VALUE is a list.
3307 It must be one of 8, 16 or 32.
3308 If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
3309 If OUTER_P is non-nil, the property is changed for the outer X window of
3310 FRAME. Default is to change on the edit X window.
3313 (prop
, value
, frame
, type
, format
, outer_p
)
3314 Lisp_Object prop
, value
, frame
, type
, format
, outer_p
;
3316 #if 0 /* MAC_TODO : port window properties to Mac */
3317 struct frame
*f
= check_x_frame (frame
);
3320 CHECK_STRING (prop
);
3321 CHECK_STRING (value
);
3324 prop_atom
= XInternAtom (FRAME_W32_DISPLAY (f
), SDATA (prop
), False
);
3325 XChangeProperty (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
),
3326 prop_atom
, XA_STRING
, 8, PropModeReplace
,
3327 SDATA (value
), SCHARS (value
));
3329 /* Make sure the property is set when we return. */
3330 XFlush (FRAME_W32_DISPLAY (f
));
3333 #endif /* MAC_TODO */
3339 DEFUN ("x-delete-window-property", Fx_delete_window_property
,
3340 Sx_delete_window_property
, 1, 2, 0,
3341 doc
: /* Remove window property PROP from X window of FRAME.
3342 FRAME nil or omitted means use the selected frame. Value is PROP. */)
3344 Lisp_Object prop
, frame
;
3346 #if 0 /* MAC_TODO : port window properties to Mac */
3348 struct frame
*f
= check_x_frame (frame
);
3351 CHECK_STRING (prop
);
3353 prop_atom
= XInternAtom (FRAME_W32_DISPLAY (f
), SDATA (prop
), False
);
3354 XDeleteProperty (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
), prop_atom
);
3356 /* Make sure the property is removed when we return. */
3357 XFlush (FRAME_W32_DISPLAY (f
));
3359 #endif /* MAC_TODO */
3365 DEFUN ("x-window-property", Fx_window_property
, Sx_window_property
,
3367 doc
: /* Value is the value of window property PROP on FRAME.
3368 If FRAME is nil or omitted, use the selected frame. Value is nil
3369 if FRAME hasn't a property with name PROP or if PROP has no string
3372 Lisp_Object prop
, frame
;
3374 #if 0 /* MAC_TODO : port window properties to Mac */
3376 struct frame
*f
= check_x_frame (frame
);
3379 Lisp_Object prop_value
= Qnil
;
3380 char *tmp_data
= NULL
;
3383 unsigned long actual_size
, bytes_remaining
;
3385 CHECK_STRING (prop
);
3387 prop_atom
= XInternAtom (FRAME_W32_DISPLAY (f
), SDATA (prop
), False
);
3388 rc
= XGetWindowProperty (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
),
3389 prop_atom
, 0, 0, False
, XA_STRING
,
3390 &actual_type
, &actual_format
, &actual_size
,
3391 &bytes_remaining
, (unsigned char **) &tmp_data
);
3394 int size
= bytes_remaining
;
3399 rc
= XGetWindowProperty (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
),
3400 prop_atom
, 0, bytes_remaining
,
3402 &actual_type
, &actual_format
,
3403 &actual_size
, &bytes_remaining
,
3404 (unsigned char **) &tmp_data
);
3406 prop_value
= make_string (tmp_data
, size
);
3415 #endif /* MAC_TODO */
3421 /***********************************************************************
3423 ***********************************************************************/
3425 /* If non-null, an asynchronous timer that, when it expires, displays
3426 an hourglass cursor on all frames. */
3428 static struct atimer
*hourglass_atimer
;
3430 /* Non-zero means an hourglass cursor is currently shown. */
3432 static int hourglass_shown_p
;
3434 /* Number of seconds to wait before displaying an hourglass cursor. */
3436 static Lisp_Object Vhourglass_delay
;
3438 /* Default number of seconds to wait before displaying an hourglass
3441 #define DEFAULT_HOURGLASS_DELAY 1
3443 /* Function prototypes. */
3445 static void show_hourglass
P_ ((struct atimer
*));
3446 static void hide_hourglass
P_ ((void));
3449 /* Cancel a currently active hourglass timer, and start a new one. */
3454 #if 0 /* MAC_TODO: cursor shape changes. */
3456 int secs
, usecs
= 0;
3458 cancel_hourglass ();
3460 if (INTEGERP (Vhourglass_delay
)
3461 && XINT (Vhourglass_delay
) > 0)
3462 secs
= XFASTINT (Vhourglass_delay
);
3463 else if (FLOATP (Vhourglass_delay
)
3464 && XFLOAT_DATA (Vhourglass_delay
) > 0)
3467 tem
= Ftruncate (Vhourglass_delay
, Qnil
);
3468 secs
= XFASTINT (tem
);
3469 usecs
= (XFLOAT_DATA (Vhourglass_delay
) - secs
) * 1000000;
3472 secs
= DEFAULT_HOURGLASS_DELAY
;
3474 EMACS_SET_SECS_USECS (delay
, secs
, usecs
);
3475 hourglass_atimer
= start_atimer (ATIMER_RELATIVE
, delay
,
3476 show_hourglass
, NULL
);
3477 #endif /* MAC_TODO */
3481 /* Cancel the hourglass cursor timer if active, hide an hourglass
3487 if (hourglass_atimer
)
3489 cancel_atimer (hourglass_atimer
);
3490 hourglass_atimer
= NULL
;
3493 if (hourglass_shown_p
)
3498 /* Timer function of hourglass_atimer. TIMER is equal to
3501 Display an hourglass cursor on all frames by mapping the frames'
3502 hourglass_window. Set the hourglass_p flag in the frames'
3503 output_data.x structure to indicate that an hourglass cursor is
3504 shown on the frames. */
3507 show_hourglass (timer
)
3508 struct atimer
*timer
;
3510 #if 0 /* MAC_TODO: cursor shape changes. */
3511 /* The timer implementation will cancel this timer automatically
3512 after this function has run. Set hourglass_atimer to null
3513 so that we know the timer doesn't have to be canceled. */
3514 hourglass_atimer
= NULL
;
3516 if (!hourglass_shown_p
)
3518 Lisp_Object rest
, frame
;
3522 FOR_EACH_FRAME (rest
, frame
)
3523 if (FRAME_W32_P (XFRAME (frame
)))
3525 struct frame
*f
= XFRAME (frame
);
3527 f
->output_data
.w32
->hourglass_p
= 1;
3529 if (!f
->output_data
.w32
->hourglass_window
)
3531 unsigned long mask
= CWCursor
;
3532 XSetWindowAttributes attrs
;
3534 attrs
.cursor
= f
->output_data
.w32
->hourglass_cursor
;
3536 f
->output_data
.w32
->hourglass_window
3537 = XCreateWindow (FRAME_X_DISPLAY (f
),
3538 FRAME_OUTER_WINDOW (f
),
3539 0, 0, 32000, 32000, 0, 0,
3545 XMapRaised (FRAME_X_DISPLAY (f
),
3546 f
->output_data
.w32
->hourglass_window
);
3547 XFlush (FRAME_X_DISPLAY (f
));
3550 hourglass_shown_p
= 1;
3553 #endif /* MAC_TODO */
3557 /* Hide the hourglass cursor on all frames, if it is currently shown. */
3562 #if 0 /* MAC_TODO: cursor shape changes. */
3563 if (hourglass_shown_p
)
3565 Lisp_Object rest
, frame
;
3568 FOR_EACH_FRAME (rest
, frame
)
3570 struct frame
*f
= XFRAME (frame
);
3573 /* Watch out for newly created frames. */
3574 && f
->output_data
.x
->hourglass_window
)
3576 XUnmapWindow (FRAME_X_DISPLAY (f
),
3577 f
->output_data
.x
->hourglass_window
);
3578 /* Sync here because XTread_socket looks at the
3579 hourglass_p flag that is reset to zero below. */
3580 XSync (FRAME_X_DISPLAY (f
), False
);
3581 f
->output_data
.x
->hourglass_p
= 0;
3585 hourglass_shown_p
= 0;
3588 #endif /* MAC_TODO */
3593 /***********************************************************************
3595 ***********************************************************************/
3597 static Lisp_Object x_create_tip_frame
P_ ((struct mac_display_info
*,
3600 /* The frame of a currently visible tooltip, or null. */
3602 Lisp_Object tip_frame
;
3604 /* If non-nil, a timer started that hides the last tooltip when it
3607 Lisp_Object tip_timer
;
3610 /* If non-nil, a vector of 3 elements containing the last args
3611 with which x-show-tip was called. See there. */
3613 Lisp_Object last_show_tip_args
;
3615 /* Create a frame for a tooltip on the display described by DPYINFO.
3616 PARMS is a list of frame parameters. Value is the frame. */
3619 x_create_tip_frame (dpyinfo
, parms
)
3620 struct mac_display_info
*dpyinfo
;
3623 #if 0 /* MAC_TODO : Mac version */
3625 Lisp_Object frame
, tem
;
3627 long window_prompting
= 0;
3629 int count
= SPECPDL_INDEX ();
3630 struct gcpro gcpro1
, gcpro2
, gcpro3
;
3635 /* Use this general default value to start with until we know if
3636 this frame has a specified name. */
3637 Vx_resource_name
= Vinvocation_name
;
3640 kb
= dpyinfo
->kboard
;
3642 kb
= &the_only_kboard
;
3645 /* Get the name of the frame to use for resource lookup. */
3646 name
= w32_get_arg (parms
, Qname
, "name", "Name", RES_TYPE_STRING
);
3648 && !EQ (name
, Qunbound
)
3650 error ("Invalid frame name--not a string or nil");
3651 Vx_resource_name
= name
;
3654 GCPRO3 (parms
, name
, frame
);
3655 tip_frame
= f
= make_frame (1);
3656 XSETFRAME (frame
, f
);
3657 FRAME_CAN_HAVE_SCROLL_BARS (f
) = 0;
3659 f
->output_method
= output_w32
;
3660 f
->output_data
.w32
=
3661 (struct w32_output
*) xmalloc (sizeof (struct w32_output
));
3662 bzero (f
->output_data
.w32
, sizeof (struct w32_output
));
3664 f
->output_data
.w32
->icon_bitmap
= -1;
3666 FRAME_FONTSET (f
) = -1;
3667 f
->icon_name
= Qnil
;
3670 FRAME_KBOARD (f
) = kb
;
3672 f
->output_data
.w32
->parent_desc
= FRAME_W32_DISPLAY_INFO (f
)->root_window
;
3673 f
->output_data
.w32
->explicit_parent
= 0;
3675 /* Set the name; the functions to which we pass f expect the name to
3677 if (EQ (name
, Qunbound
) || NILP (name
))
3679 f
->name
= build_string (dpyinfo
->x_id_name
);
3680 f
->explicit_name
= 0;
3685 f
->explicit_name
= 1;
3686 /* use the frame's title when getting resources for this frame. */
3687 specbind (Qx_resource_name
, name
);
3690 /* Extract the window parameters from the supplied values
3691 that are needed to determine window geometry. */
3695 font
= w32_get_arg (parms
, Qfont
, "font", "Font", RES_TYPE_STRING
);
3698 /* First, try whatever font the caller has specified. */
3701 tem
= Fquery_fontset (font
, Qnil
);
3703 font
= x_new_fontset (f
, SDATA (tem
));
3705 font
= x_new_font (f
, SDATA (font
));
3708 /* Try out a font which we hope has bold and italic variations. */
3709 if (!STRINGP (font
))
3710 font
= x_new_font (f
, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
3711 if (!STRINGP (font
))
3712 font
= x_new_font (f
, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
3713 if (! STRINGP (font
))
3714 font
= x_new_font (f
, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
3715 if (! STRINGP (font
))
3716 /* This was formerly the first thing tried, but it finds too many fonts
3717 and takes too long. */
3718 font
= x_new_font (f
, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
3719 /* If those didn't work, look for something which will at least work. */
3720 if (! STRINGP (font
))
3721 font
= x_new_font (f
, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
3723 if (! STRINGP (font
))
3724 font
= build_string ("fixed");
3726 x_default_parameter (f
, parms
, Qfont
, font
,
3727 "font", "Font", RES_TYPE_STRING
);
3730 x_default_parameter (f
, parms
, Qborder_width
, make_number (2),
3731 "borderWidth", "BorderWidth", RES_TYPE_NUMBER
);
3733 /* This defaults to 2 in order to match xterm. We recognize either
3734 internalBorderWidth or internalBorder (which is what xterm calls
3736 if (NILP (Fassq (Qinternal_border_width
, parms
)))
3740 value
= w32_get_arg (parms
, Qinternal_border_width
,
3741 "internalBorder", "internalBorder", RES_TYPE_NUMBER
);
3742 if (! EQ (value
, Qunbound
))
3743 parms
= Fcons (Fcons (Qinternal_border_width
, value
),
3747 x_default_parameter (f
, parms
, Qinternal_border_width
, make_number (1),
3748 "internalBorderWidth", "internalBorderWidth",
3751 /* Also do the stuff which must be set before the window exists. */
3752 x_default_parameter (f
, parms
, Qforeground_color
, build_string ("black"),
3753 "foreground", "Foreground", RES_TYPE_STRING
);
3754 x_default_parameter (f
, parms
, Qbackground_color
, build_string ("white"),
3755 "background", "Background", RES_TYPE_STRING
);
3756 x_default_parameter (f
, parms
, Qmouse_color
, build_string ("black"),
3757 "pointerColor", "Foreground", RES_TYPE_STRING
);
3758 x_default_parameter (f
, parms
, Qcursor_color
, build_string ("black"),
3759 "cursorColor", "Foreground", RES_TYPE_STRING
);
3760 x_default_parameter (f
, parms
, Qborder_color
, build_string ("black"),
3761 "borderColor", "BorderColor", RES_TYPE_STRING
);
3763 /* Init faces before x_default_parameter is called for scroll-bar
3764 parameters because that function calls x_set_scroll_bar_width,
3765 which calls change_frame_size, which calls Fset_window_buffer,
3766 which runs hooks, which call Fvertical_motion. At the end, we
3767 end up in init_iterator with a null face cache, which should not
3769 init_frame_faces (f
);
3771 f
->output_data
.w32
->parent_desc
= FRAME_W32_DISPLAY_INFO (f
)->root_window
;
3773 window_prompting
= x_figure_window_size (f
, parms
, 0);
3776 XSetWindowAttributes attrs
;
3780 mask
= CWBackPixel
| CWOverrideRedirect
| CWSaveUnder
| CWEventMask
;
3781 /* Window managers looks at the override-redirect flag to
3782 determine whether or net to give windows a decoration (Xlib
3784 attrs
.override_redirect
= True
;
3785 attrs
.save_under
= True
;
3786 attrs
.background_pixel
= FRAME_BACKGROUND_PIXEL (f
);
3787 /* Arrange for getting MapNotify and UnmapNotify events. */
3788 attrs
.event_mask
= StructureNotifyMask
;
3790 = FRAME_W32_WINDOW (f
)
3791 = XCreateWindow (FRAME_W32_DISPLAY (f
),
3792 FRAME_W32_DISPLAY_INFO (f
)->root_window
,
3793 /* x, y, width, height */
3797 CopyFromParent
, InputOutput
, CopyFromParent
,
3804 x_default_parameter (f
, parms
, Qauto_raise
, Qnil
,
3805 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN
);
3806 x_default_parameter (f
, parms
, Qauto_lower
, Qnil
,
3807 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN
);
3808 x_default_parameter (f
, parms
, Qcursor_type
, Qbox
,
3809 "cursorType", "CursorType", RES_TYPE_SYMBOL
);
3811 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
3812 Change will not be effected unless different from the current
3814 width
= FRAME_COLS (f
);
3815 height
= FRAME_LINES (f
);
3816 FRAME_LINES (f
) = 0;
3817 SET_FRAME_COLS (f
, 0);
3818 change_frame_size (f
, height
, width
, 1, 0, 0);
3820 /* Add `tooltip' frame parameter's default value. */
3821 if (NILP (Fframe_parameter (frame
, intern ("tooltip"))))
3822 Fmodify_frame_parameters (frame
, Fcons (Fcons (intern ("tooltip"), Qt
),
3829 /* It is now ok to make the frame official even if we get an error
3830 below. And the frame needs to be on Vframe_list or making it
3831 visible won't work. */
3832 Vframe_list
= Fcons (frame
, Vframe_list
);
3834 /* Now that the frame is official, it counts as a reference to
3836 FRAME_W32_DISPLAY_INFO (f
)->reference_count
++;
3838 return unbind_to (count
, frame
);
3839 #endif /* MAC_TODO */
3844 DEFUN ("x-show-tip", Fx_show_tip
, Sx_show_tip
, 1, 6, 0,
3845 doc
: /* Show STRING in a "tooltip" window on frame FRAME.
3846 A tooltip window is a small window displaying a string.
3848 FRAME nil or omitted means use the selected frame.
3850 PARMS is an optional list of frame parameters which can be used to
3851 change the tooltip's appearance.
3853 Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
3854 means use the default timeout of 5 seconds.
3856 If the list of frame parameters PARAMS contains a `left' parameters,
3857 the tooltip is displayed at that x-position. Otherwise it is
3858 displayed at the mouse position, with offset DX added (default is 5 if
3859 DX isn't specified). Likewise for the y-position; if a `top' frame
3860 parameter is specified, it determines the y-position of the tooltip
3861 window, otherwise it is displayed at the mouse position, with offset
3862 DY added (default is 10). */)
3863 (string
, frame
, parms
, timeout
, dx
, dy
)
3864 Lisp_Object string
, frame
, parms
, timeout
, dx
, dy
;
3869 Lisp_Object buffer
, top
, left
;
3870 struct buffer
*old_buffer
;
3871 struct text_pos pos
;
3872 int i
, width
, height
;
3873 int root_x
, root_y
, win_x
, win_y
;
3875 struct gcpro gcpro1
, gcpro2
, gcpro3
, gcpro4
;
3876 int old_windows_or_buffers_changed
= windows_or_buffers_changed
;
3877 int count
= SPECPDL_INDEX ();
3879 specbind (Qinhibit_redisplay
, Qt
);
3881 GCPRO4 (string
, parms
, frame
, timeout
);
3883 CHECK_STRING (string
);
3884 f
= check_x_frame (frame
);
3886 timeout
= make_number (5);
3888 CHECK_NATNUM (timeout
);
3891 dx
= make_number (5);
3896 dy
= make_number (-10);
3900 if (NILP (last_show_tip_args
))
3901 last_show_tip_args
= Fmake_vector (make_number (3), Qnil
);
3903 if (!NILP (tip_frame
))
3905 Lisp_Object last_string
= AREF (last_show_tip_args
, 0);
3906 Lisp_Object last_frame
= AREF (last_show_tip_args
, 1);
3907 Lisp_Object last_parms
= AREF (last_show_tip_args
, 2);
3909 if (EQ (frame
, last_frame
)
3910 && !NILP (Fequal (last_string
, string
))
3911 && !NILP (Fequal (last_parms
, parms
)))
3913 struct frame
*f
= XFRAME (tip_frame
);
3915 /* Only DX and DY have changed. */
3916 if (!NILP (tip_timer
))
3918 Lisp_Object timer
= tip_timer
;
3920 call1 (Qcancel_timer
, timer
);
3923 #if 0 /* MAC_TODO : Mac specifics */
3925 compute_tip_xy (f
, parms
, dx
, dy
, &root_x
, &root_y
);
3926 XMoveWindow (FRAME_X_DISPLAY (f
), FRAME_X_WINDOW (f
),
3927 root_x
, root_y
- FRAME_PIXEL_HEIGHT (f
));
3929 #endif /* MAC_TODO */
3934 /* Hide a previous tip, if any. */
3937 ASET (last_show_tip_args
, 0, string
);
3938 ASET (last_show_tip_args
, 1, frame
);
3939 ASET (last_show_tip_args
, 2, parms
);
3941 /* Add default values to frame parameters. */
3942 if (NILP (Fassq (Qname
, parms
)))
3943 parms
= Fcons (Fcons (Qname
, build_string ("tooltip")), parms
);
3944 if (NILP (Fassq (Qinternal_border_width
, parms
)))
3945 parms
= Fcons (Fcons (Qinternal_border_width
, make_number (3)), parms
);
3946 if (NILP (Fassq (Qborder_width
, parms
)))
3947 parms
= Fcons (Fcons (Qborder_width
, make_number (1)), parms
);
3948 if (NILP (Fassq (Qborder_color
, parms
)))
3949 parms
= Fcons (Fcons (Qborder_color
, build_string ("lightyellow")), parms
);
3950 if (NILP (Fassq (Qbackground_color
, parms
)))
3951 parms
= Fcons (Fcons (Qbackground_color
, build_string ("lightyellow")),
3954 /* Create a frame for the tooltip, and record it in the global
3955 variable tip_frame. */
3956 frame
= x_create_tip_frame (FRAME_MAC_DISPLAY_INFO (f
), parms
);
3959 /* Set up the frame's root window. Currently we use a size of 80
3960 columns x 40 lines. If someone wants to show a larger tip, he
3961 will loose. I don't think this is a realistic case. */
3962 w
= XWINDOW (FRAME_ROOT_WINDOW (f
));
3963 w
->left_col
= w
->top_line
= make_number (0);
3964 w
->total_cols
= make_number (80);
3965 w
->total_lines
= make_number (40);
3967 w
->pseudo_window_p
= 1;
3969 /* Display the tooltip text in a temporary buffer. */
3970 buffer
= Fget_buffer_create (build_string (" *tip*"));
3971 Fset_window_buffer (FRAME_ROOT_WINDOW (f
), buffer
, Qnil
);
3972 old_buffer
= current_buffer
;
3973 set_buffer_internal_1 (XBUFFER (buffer
));
3975 Finsert (1, &string
);
3976 clear_glyph_matrix (w
->desired_matrix
);
3977 clear_glyph_matrix (w
->current_matrix
);
3978 SET_TEXT_POS (pos
, BEGV
, BEGV_BYTE
);
3979 try_window (FRAME_ROOT_WINDOW (f
), pos
);
3981 /* Compute width and height of the tooltip. */
3983 for (i
= 0; i
< w
->desired_matrix
->nrows
; ++i
)
3985 struct glyph_row
*row
= &w
->desired_matrix
->rows
[i
];
3989 /* Stop at the first empty row at the end. */
3990 if (!row
->enabled_p
|| !row
->displays_text_p
)
3993 /* Let the row go over the full width of the frame. */
3994 row
->full_width_p
= 1;
3996 /* There's a glyph at the end of rows that is use to place
3997 the cursor there. Don't include the width of this glyph. */
3998 if (row
->used
[TEXT_AREA
])
4000 last
= &row
->glyphs
[TEXT_AREA
][row
->used
[TEXT_AREA
] - 1];
4001 row_width
= row
->pixel_width
- last
->pixel_width
;
4004 row_width
= row
->pixel_width
;
4006 height
+= row
->height
;
4007 width
= max (width
, row_width
);
4010 /* Add the frame's internal border to the width and height the X
4011 window should have. */
4012 height
+= 2 * FRAME_INTERNAL_BORDER_WIDTH (f
);
4013 width
+= 2 * FRAME_INTERNAL_BORDER_WIDTH (f
);
4015 /* Move the tooltip window where the mouse pointer is. Resize and
4017 #if 0 /* TODO : Mac specifics */
4018 compute_tip_xy (f
, parms
, dx
, dy
, &root_x
, &root_y
);
4021 XQueryPointer (FRAME_W32_DISPLAY (f
), FRAME_W32_DISPLAY_INFO (f
)->root_window
,
4022 &root
, &child
, &root_x
, &root_y
, &win_x
, &win_y
, &pmask
);
4023 XMoveResizeWindow (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
),
4024 root_x
+ 5, root_y
- height
- 5, width
, height
);
4025 XMapRaised (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
));
4027 #endif /* MAC_TODO */
4029 /* Draw into the window. */
4030 w
->must_be_updated_p
= 1;
4031 update_single_window (w
, 1);
4033 /* Restore original current buffer. */
4034 set_buffer_internal_1 (old_buffer
);
4035 windows_or_buffers_changed
= old_windows_or_buffers_changed
;
4038 /* Let the tip disappear after timeout seconds. */
4039 tip_timer
= call3 (intern ("run-at-time"), timeout
, Qnil
,
4040 intern ("x-hide-tip"));
4043 return unbind_to (count
, Qnil
);
4047 DEFUN ("x-hide-tip", Fx_hide_tip
, Sx_hide_tip
, 0, 0, 0,
4048 doc
: /* Hide the current tooltip window, if there is any.
4049 Value is t is tooltip was open, nil otherwise. */)
4053 Lisp_Object deleted
, frame
, timer
;
4054 struct gcpro gcpro1
, gcpro2
;
4056 /* Return quickly if nothing to do. */
4057 if (NILP (tip_timer
) && NILP (tip_frame
))
4062 GCPRO2 (frame
, timer
);
4063 tip_frame
= tip_timer
= deleted
= Qnil
;
4065 count
= SPECPDL_INDEX ();
4066 specbind (Qinhibit_redisplay
, Qt
);
4067 specbind (Qinhibit_quit
, Qt
);
4070 call1 (Qcancel_timer
, timer
);
4074 Fdelete_frame (frame
, Qnil
);
4079 return unbind_to (count
, deleted
);
4084 /***********************************************************************
4085 File selection dialog
4086 ***********************************************************************/
4088 #if 0 /* MAC_TODO: can standard file dialog */
4089 extern Lisp_Object Qfile_name_history
;
4091 DEFUN ("x-file-dialog", Fx_file_dialog
, Sx_file_dialog
, 2, 4, 0,
4092 doc
: /* Read file name, prompting with PROMPT in directory DIR.
4093 Use a file selection dialog.
4094 Select DEFAULT-FILENAME in the dialog's file selection box, if
4095 specified. Don't let the user enter a file name in the file
4096 selection dialog's entry field, if MUSTMATCH is non-nil. */)
4097 (prompt
, dir
, default_filename
, mustmatch
)
4098 Lisp_Object prompt
, dir
, default_filename
, mustmatch
;
4100 struct frame
*f
= SELECTED_FRAME ();
4101 Lisp_Object file
= Qnil
;
4102 int count
= SPECPDL_INDEX ();
4103 struct gcpro gcpro1
, gcpro2
, gcpro3
, gcpro4
, gcpro5
;
4104 char filename
[MAX_PATH
+ 1];
4105 char init_dir
[MAX_PATH
+ 1];
4106 int use_dialog_p
= 1;
4108 GCPRO5 (prompt
, dir
, default_filename
, mustmatch
, file
);
4109 CHECK_STRING (prompt
);
4112 /* Create the dialog with PROMPT as title, using DIR as initial
4113 directory and using "*" as pattern. */
4114 dir
= Fexpand_file_name (dir
, Qnil
);
4115 strncpy (init_dir
, SDATA (dir
), MAX_PATH
);
4116 init_dir
[MAX_PATH
] = '\0';
4117 unixtodos_filename (init_dir
);
4119 if (STRINGP (default_filename
))
4121 char *file_name_only
;
4122 char *full_path_name
= SDATA (default_filename
);
4124 unixtodos_filename (full_path_name
);
4126 file_name_only
= strrchr (full_path_name
, '\\');
4127 if (!file_name_only
)
4128 file_name_only
= full_path_name
;
4133 /* If default_file_name is a directory, don't use the open
4134 file dialog, as it does not support selecting
4136 if (!(*file_name_only
))
4140 strncpy (filename
, file_name_only
, MAX_PATH
);
4141 filename
[MAX_PATH
] = '\0';
4148 OPENFILENAME file_details
;
4149 char *filename_file
;
4151 /* Prevent redisplay. */
4152 specbind (Qinhibit_redisplay
, Qt
);
4155 bzero (&file_details
, sizeof (file_details
));
4156 file_details
.lStructSize
= sizeof (file_details
);
4157 file_details
.hwndOwner
= FRAME_W32_WINDOW (f
);
4158 file_details
.lpstrFile
= filename
;
4159 file_details
.nMaxFile
= sizeof (filename
);
4160 file_details
.lpstrInitialDir
= init_dir
;
4161 file_details
.lpstrTitle
= SDATA (prompt
);
4162 file_details
.Flags
= OFN_HIDEREADONLY
| OFN_NOCHANGEDIR
;
4164 if (!NILP (mustmatch
))
4165 file_details
.Flags
|= OFN_FILEMUSTEXIST
| OFN_PATHMUSTEXIST
;
4167 if (GetOpenFileName (&file_details
))
4169 dostounix_filename (filename
);
4170 file
= build_string (filename
);
4176 file
= unbind_to (count
, file
);
4178 /* Open File dialog will not allow folders to be selected, so resort
4179 to minibuffer completing reads for directories. */
4181 file
= Fcompleting_read (prompt
, intern ("read-file-name-internal"),
4182 dir
, mustmatch
, dir
, Qfile_name_history
,
4183 default_filename
, Qnil
);
4187 /* Make "Cancel" equivalent to C-g. */
4189 Fsignal (Qquit
, Qnil
);
4191 return unbind_to (count
, file
);
4193 #endif /* MAC_TODO */
4197 /***********************************************************************
4199 ***********************************************************************/
4201 /* Keep this list in the same order as frame_parms in frame.c.
4202 Use 0 for unsupported frame parameters. */
4204 frame_parm_handler mac_frame_parm_handlers
[] =
4208 x_set_background_color
,
4214 x_set_foreground_color
,
4216 0, /* MAC_TODO: x_set_icon_type, */
4217 x_set_internal_border_width
,
4218 x_set_menu_bar_lines
,
4220 x_explicitly_set_name
,
4221 x_set_scroll_bar_width
,
4224 x_set_vertical_scroll_bars
,
4226 x_set_tool_bar_lines
,
4227 0, /* MAC_TODO: x_set_scroll_bar_foreground, */
4228 0, /* MAC_TODO: x_set_scroll_bar_background, */
4231 0, /* MAC_TODO: x_set_fringe_width, */
4232 0, /* MAC_TODO: x_set_fringe_width, */
4233 0, /* x_set_wait_for_wm, */
4234 0, /* MAC_TODO: x_set_fullscreen, */
4240 /* Certainly running on Mac. */
4243 /* The section below is built by the lisp expression at the top of the file,
4244 just above where these variables are declared. */
4245 /*&&& init symbols here &&&*/
4246 Qnone
= intern ("none");
4248 Qsuppress_icon
= intern ("suppress-icon");
4249 staticpro (&Qsuppress_icon
);
4250 Qundefined_color
= intern ("undefined-color");
4251 staticpro (&Qundefined_color
);
4252 /* This is the end of symbol initialization. */
4254 Qhyper
= intern ("hyper");
4255 staticpro (&Qhyper
);
4256 Qsuper
= intern ("super");
4257 staticpro (&Qsuper
);
4258 Qmeta
= intern ("meta");
4260 Qalt
= intern ("alt");
4262 Qctrl
= intern ("ctrl");
4264 Qcontrol
= intern ("control");
4265 staticpro (&Qcontrol
);
4266 Qshift
= intern ("shift");
4267 staticpro (&Qshift
);
4269 /* Text property `display' should be nonsticky by default. */
4270 Vtext_property_default_nonsticky
4271 = Fcons (Fcons (Qdisplay
, Qt
), Vtext_property_default_nonsticky
);
4273 Qface_set_after_frame_default
= intern ("face-set-after-frame-default");
4274 staticpro (&Qface_set_after_frame_default
);
4276 Fput (Qundefined_color
, Qerror_conditions
,
4277 Fcons (Qundefined_color
, Fcons (Qerror
, Qnil
)));
4278 Fput (Qundefined_color
, Qerror_message
,
4279 build_string ("Undefined color"));
4281 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape
,
4282 doc
: /* The shape of the pointer when over text.
4283 Changing the value does not affect existing frames
4284 unless you set the mouse color. */);
4285 Vx_pointer_shape
= Qnil
;
4287 Vx_nontext_pointer_shape
= Qnil
;
4289 Vx_mode_pointer_shape
= Qnil
;
4291 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape
,
4292 doc
: /* The shape of the pointer when Emacs is hourglass.
4293 This variable takes effect when you create a new frame
4294 or when you set the mouse color. */);
4295 Vx_hourglass_pointer_shape
= Qnil
;
4297 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p
,
4298 doc
: /* Non-zero means Emacs displays an hourglass pointer on window systems. */);
4299 display_hourglass_p
= 1;
4301 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay
,
4302 doc
: /* *Seconds to wait before displaying an hourglass pointer.
4303 Value must be an integer or float. */);
4304 Vhourglass_delay
= make_number (DEFAULT_HOURGLASS_DELAY
);
4306 DEFVAR_LISP ("x-sensitive-text-pointer-shape",
4307 &Vx_sensitive_text_pointer_shape
,
4308 doc
: /* The shape of the pointer when over mouse-sensitive text.
4309 This variable takes effect when you create a new frame
4310 or when you set the mouse color. */);
4311 Vx_sensitive_text_pointer_shape
= Qnil
;
4313 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel
,
4314 doc
: /* A string indicating the foreground color of the cursor box. */);
4315 Vx_cursor_fore_pixel
= Qnil
;
4317 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager
,
4318 doc
: /* Non-nil if no window manager is in use.
4319 Emacs doesn't try to figure this out; this is always nil
4320 unless you set it to something else. */);
4321 /* We don't have any way to find this out, so set it to nil
4322 and maybe the user would like to set it to t. */
4323 Vx_no_window_manager
= Qnil
;
4325 DEFVAR_LISP ("x-pixel-size-width-font-regexp",
4326 &Vx_pixel_size_width_font_regexp
,
4327 doc
: /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'.
4329 Since Emacs gets width of a font matching with this regexp from
4330 PIXEL_SIZE field of the name, font finding mechanism gets faster for
4331 such a font. This is especially effective for such large fonts as
4332 Chinese, Japanese, and Korean. */);
4333 Vx_pixel_size_width_font_regexp
= Qnil
;
4335 /* X window properties. */
4336 defsubr (&Sx_change_window_property
);
4337 defsubr (&Sx_delete_window_property
);
4338 defsubr (&Sx_window_property
);
4340 defsubr (&Sxw_display_color_p
);
4341 defsubr (&Sx_display_grayscale_p
);
4342 defsubr (&Sxw_color_defined_p
);
4343 defsubr (&Sxw_color_values
);
4344 defsubr (&Sx_server_max_request_size
);
4345 defsubr (&Sx_server_vendor
);
4346 defsubr (&Sx_server_version
);
4347 defsubr (&Sx_display_pixel_width
);
4348 defsubr (&Sx_display_pixel_height
);
4349 defsubr (&Sx_display_mm_width
);
4350 defsubr (&Sx_display_mm_height
);
4351 defsubr (&Sx_display_screens
);
4352 defsubr (&Sx_display_planes
);
4353 defsubr (&Sx_display_color_cells
);
4354 defsubr (&Sx_display_visual_class
);
4355 defsubr (&Sx_display_backing_store
);
4356 defsubr (&Sx_display_save_under
);
4357 defsubr (&Sx_create_frame
);
4358 #if 0 /* MAC_TODO: implement network support */
4359 defsubr (&Sx_open_connection
);
4360 defsubr (&Sx_close_connection
);
4362 defsubr (&Sx_display_list
);
4363 defsubr (&Sx_synchronize
);
4365 /* Setting callback functions for fontset handler. */
4366 get_font_info_func
= x_get_font_info
;
4368 #if 0 /* This function pointer doesn't seem to be used anywhere.
4369 And the pointer assigned has the wrong type, anyway. */
4370 list_fonts_func
= x_list_fonts
;
4373 load_font_func
= x_load_font
;
4374 find_ccl_program_func
= x_find_ccl_program
;
4375 query_font_func
= x_query_font
;
4376 set_frame_fontset_func
= x_set_font
;
4377 check_window_system_func
= check_mac
;
4379 hourglass_atimer
= NULL
;
4380 hourglass_shown_p
= 0;
4382 defsubr (&Sx_show_tip
);
4383 defsubr (&Sx_hide_tip
);
4385 staticpro (&tip_timer
);
4387 staticpro (&tip_frame
);
4389 #if 0 /* MAC_TODO */
4390 defsubr (&Sx_file_dialog
);
4394 /* arch-tag: d7591289-f374-4377-b245-12f5dbbb8edc
4395 (do not change this comment) */