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
;
175 /* Functions in macterm.c. */
176 extern void x_set_window_size (struct frame
*, int, int, int);
177 extern void x_make_frame_visible (struct frame
*);
178 extern struct mac_display_info
*mac_term_init (Lisp_Object
, char *, char *);
179 extern struct font_info
*x_get_font_info (FRAME_PTR
, int);
180 extern struct font_info
*x_load_font (struct frame
*, char *, int);
181 extern void x_find_ccl_program (struct font_info
*);
182 extern struct font_info
*x_query_font (struct frame
*, char *);
183 extern void mac_initialize ();
184 extern Pixmap
XCreatePixmap (Display
*, WindowPtr
, unsigned int, unsigned int, unsigned int);
185 extern Pixmap
XCreatePixmapFromBitmapData (Display
*, WindowPtr
, char *, unsigned int, unsigned int, unsigned long, unsigned long, unsigned int);
186 extern void XFreePixmap (Display
*, Pixmap
);
187 extern void XSetForeground (Display
*, GC
, unsigned long);
188 extern void mac_draw_line_to_pixmap (Display
*, Pixmap
, GC
, int, int, int, int);
191 /* compare two strings ignoring case */
194 stricmp (const char *s
, const char *t
)
196 for ( ; tolower (*s
) == tolower (*t
); s
++, t
++)
199 return tolower (*s
) - tolower (*t
);
202 /* compare two strings up to n characters, ignoring case */
205 strnicmp (const char *s
, const char *t
, unsigned int n
)
207 for ( ; n
-- > 0 && tolower (*s
) == tolower (*t
); s
++, t
++)
210 return n
== 0 ? 0 : tolower (*s
) - tolower (*t
);
214 /* Error if we are not running on Mac OS. */
220 error ("Mac OS not in use or not initialized");
223 /* Nonzero if we can use mouse menus.
224 You should not call this unless HAVE_MENUS is defined. */
232 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame
233 and checking validity for Mac. */
236 check_x_frame (frame
)
242 frame
= selected_frame
;
243 CHECK_LIVE_FRAME (frame
);
245 if (! FRAME_MAC_P (f
))
246 error ("non-mac frame used");
250 /* Let the user specify a display with a frame.
251 nil stands for the selected frame--or, if that is not a mac frame,
252 the first display on the list. */
254 struct mac_display_info
*
255 check_x_display_info (frame
)
258 if (!mac_initialized
)
266 struct frame
*sf
= XFRAME (selected_frame
);
268 if (FRAME_MAC_P (sf
) && FRAME_LIVE_P (sf
))
269 return FRAME_MAC_DISPLAY_INFO (sf
);
271 return &one_mac_display_info
;
273 else if (STRINGP (frame
))
274 return x_display_info_for_name (frame
);
279 CHECK_LIVE_FRAME (frame
);
281 if (! FRAME_MAC_P (f
))
282 error ("non-mac frame used");
283 return FRAME_MAC_DISPLAY_INFO (f
);
287 /* Return the Emacs frame-object corresponding to a mac window.
288 It could be the frame's main window or an icon window. */
290 /* This function can be called during GC, so use GC_xxx type test macros. */
293 x_window_to_frame (dpyinfo
, wdesc
)
294 struct mac_display_info
*dpyinfo
;
297 Lisp_Object tail
, frame
;
300 for (tail
= Vframe_list
; GC_CONSP (tail
); tail
= XCDR (tail
))
303 if (!GC_FRAMEP (frame
))
306 if (!FRAME_W32_P (f
) || FRAME_MAC_DISPLAY_INFO (f
) != dpyinfo
)
308 /*if (f->output_data.w32->hourglass_window == wdesc)
311 /* MAC_TODO: Check tooltips when supported. */
312 if (FRAME_MAC_WINDOW (f
) == wdesc
)
319 static Lisp_Object unwind_create_frame
P_ ((Lisp_Object
));
321 void x_set_foreground_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
322 void x_set_background_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
323 void x_set_mouse_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
324 void x_set_cursor_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
325 void x_set_border_color
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
326 void x_set_cursor_type
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
327 void x_set_icon_type
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
328 void x_set_icon_name
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
329 void x_explicitly_set_name
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
330 void x_set_menu_bar_lines
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
331 void x_set_title
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
332 void x_set_tool_bar_lines
P_ ((struct frame
*, Lisp_Object
, Lisp_Object
));
333 void x_set_scroll_bar_foreground
P_ ((struct frame
*, Lisp_Object
,
335 void x_set_scroll_bar_background
P_ ((struct frame
*, Lisp_Object
,
337 static Lisp_Object x_default_scroll_bar_color_parameter
P_ ((struct frame
*,
342 /* Store the screen positions of frame F into XPTR and YPTR.
343 These are the positions of the containing window manager window,
344 not Emacs's own window. */
347 x_real_positions (f
, xptr
, yptr
)
354 #ifdef TARGET_API_MAC_CARBON
358 GetWindowPortBounds (f
->output_data
.mac
->mWP
, &r
);
359 SetPt (&pt
, r
.left
, r
.top
);
361 #else /* not TARGET_API_MAC_CARBON */
363 f
->output_data
.mac
->mWP
->portRect
.left
,
364 f
->output_data
.mac
->mWP
->portRect
.top
);
365 #endif /* not TARGET_API_MAC_CARBON */
370 /* MAC has no frame pixel diff. */
371 f
->x_pixels_diff
= 0;
372 f
->y_pixels_diff
= 0;
379 /* The default colors for the Mac color map */
380 typedef struct colormap_t
386 colormap_t mac_color_map
[] =
388 { RGB_TO_ULONG(255, 250, 250), "snow" },
389 { RGB_TO_ULONG(248, 248, 255), "ghost white" },
390 { RGB_TO_ULONG(248, 248, 255), "GhostWhite" },
391 { RGB_TO_ULONG(245, 245, 245), "white smoke" },
392 { RGB_TO_ULONG(245, 245, 245), "WhiteSmoke" },
393 { RGB_TO_ULONG(220, 220, 220), "gainsboro" },
394 { RGB_TO_ULONG(255, 250, 240), "floral white" },
395 { RGB_TO_ULONG(255, 250, 240), "FloralWhite" },
396 { RGB_TO_ULONG(253, 245, 230), "old lace" },
397 { RGB_TO_ULONG(253, 245, 230), "OldLace" },
398 { RGB_TO_ULONG(250, 240, 230), "linen" },
399 { RGB_TO_ULONG(250, 235, 215), "antique white" },
400 { RGB_TO_ULONG(250, 235, 215), "AntiqueWhite" },
401 { RGB_TO_ULONG(255, 239, 213), "papaya whip" },
402 { RGB_TO_ULONG(255, 239, 213), "PapayaWhip" },
403 { RGB_TO_ULONG(255, 235, 205), "blanched almond" },
404 { RGB_TO_ULONG(255, 235, 205), "BlanchedAlmond" },
405 { RGB_TO_ULONG(255, 228, 196), "bisque" },
406 { RGB_TO_ULONG(255, 218, 185), "peach puff" },
407 { RGB_TO_ULONG(255, 218, 185), "PeachPuff" },
408 { RGB_TO_ULONG(255, 222, 173), "navajo white" },
409 { RGB_TO_ULONG(255, 222, 173), "NavajoWhite" },
410 { RGB_TO_ULONG(255, 228, 181), "moccasin" },
411 { RGB_TO_ULONG(255, 248, 220), "cornsilk" },
412 { RGB_TO_ULONG(255, 255, 240), "ivory" },
413 { RGB_TO_ULONG(255, 250, 205), "lemon chiffon" },
414 { RGB_TO_ULONG(255, 250, 205), "LemonChiffon" },
415 { RGB_TO_ULONG(255, 245, 238), "seashell" },
416 { RGB_TO_ULONG(240, 255, 240), "honeydew" },
417 { RGB_TO_ULONG(245, 255, 250), "mint cream" },
418 { RGB_TO_ULONG(245, 255, 250), "MintCream" },
419 { RGB_TO_ULONG(240, 255, 255), "azure" },
420 { RGB_TO_ULONG(240, 248, 255), "alice blue" },
421 { RGB_TO_ULONG(240, 248, 255), "AliceBlue" },
422 { RGB_TO_ULONG(230, 230, 250), "lavender" },
423 { RGB_TO_ULONG(255, 240, 245), "lavender blush" },
424 { RGB_TO_ULONG(255, 240, 245), "LavenderBlush" },
425 { RGB_TO_ULONG(255, 228, 225), "misty rose" },
426 { RGB_TO_ULONG(255, 228, 225), "MistyRose" },
427 { RGB_TO_ULONG(255, 255, 255), "white" },
428 { RGB_TO_ULONG(0 , 0 , 0 ), "black" },
429 { RGB_TO_ULONG(47 , 79 , 79 ), "dark slate gray" },
430 { RGB_TO_ULONG(47 , 79 , 79 ), "DarkSlateGray" },
431 { RGB_TO_ULONG(47 , 79 , 79 ), "dark slate grey" },
432 { RGB_TO_ULONG(47 , 79 , 79 ), "DarkSlateGrey" },
433 { RGB_TO_ULONG(105, 105, 105), "dim gray" },
434 { RGB_TO_ULONG(105, 105, 105), "DimGray" },
435 { RGB_TO_ULONG(105, 105, 105), "dim grey" },
436 { RGB_TO_ULONG(105, 105, 105), "DimGrey" },
437 { RGB_TO_ULONG(112, 128, 144), "slate gray" },
438 { RGB_TO_ULONG(112, 128, 144), "SlateGray" },
439 { RGB_TO_ULONG(112, 128, 144), "slate grey" },
440 { RGB_TO_ULONG(112, 128, 144), "SlateGrey" },
441 { RGB_TO_ULONG(119, 136, 153), "light slate gray" },
442 { RGB_TO_ULONG(119, 136, 153), "LightSlateGray" },
443 { RGB_TO_ULONG(119, 136, 153), "light slate grey" },
444 { RGB_TO_ULONG(119, 136, 153), "LightSlateGrey" },
445 { RGB_TO_ULONG(190, 190, 190), "gray" },
446 { RGB_TO_ULONG(190, 190, 190), "grey" },
447 { RGB_TO_ULONG(211, 211, 211), "light grey" },
448 { RGB_TO_ULONG(211, 211, 211), "LightGrey" },
449 { RGB_TO_ULONG(211, 211, 211), "light gray" },
450 { RGB_TO_ULONG(211, 211, 211), "LightGray" },
451 { RGB_TO_ULONG(25 , 25 , 112), "midnight blue" },
452 { RGB_TO_ULONG(25 , 25 , 112), "MidnightBlue" },
453 { RGB_TO_ULONG(0 , 0 , 128), "navy" },
454 { RGB_TO_ULONG(0 , 0 , 128), "navy blue" },
455 { RGB_TO_ULONG(0 , 0 , 128), "NavyBlue" },
456 { RGB_TO_ULONG(100, 149, 237), "cornflower blue" },
457 { RGB_TO_ULONG(100, 149, 237), "CornflowerBlue" },
458 { RGB_TO_ULONG(72 , 61 , 139), "dark slate blue" },
459 { RGB_TO_ULONG(72 , 61 , 139), "DarkSlateBlue" },
460 { RGB_TO_ULONG(106, 90 , 205), "slate blue" },
461 { RGB_TO_ULONG(106, 90 , 205), "SlateBlue" },
462 { RGB_TO_ULONG(123, 104, 238), "medium slate blue" },
463 { RGB_TO_ULONG(123, 104, 238), "MediumSlateBlue" },
464 { RGB_TO_ULONG(132, 112, 255), "light slate blue" },
465 { RGB_TO_ULONG(132, 112, 255), "LightSlateBlue" },
466 { RGB_TO_ULONG(0 , 0 , 205), "medium blue" },
467 { RGB_TO_ULONG(0 , 0 , 205), "MediumBlue" },
468 { RGB_TO_ULONG(65 , 105, 225), "royal blue" },
469 { RGB_TO_ULONG(65 , 105, 225), "RoyalBlue" },
470 { RGB_TO_ULONG(0 , 0 , 255), "blue" },
471 { RGB_TO_ULONG(30 , 144, 255), "dodger blue" },
472 { RGB_TO_ULONG(30 , 144, 255), "DodgerBlue" },
473 { RGB_TO_ULONG(0 , 191, 255), "deep sky blue" },
474 { RGB_TO_ULONG(0 , 191, 255), "DeepSkyBlue" },
475 { RGB_TO_ULONG(135, 206, 235), "sky blue" },
476 { RGB_TO_ULONG(135, 206, 235), "SkyBlue" },
477 { RGB_TO_ULONG(135, 206, 250), "light sky blue" },
478 { RGB_TO_ULONG(135, 206, 250), "LightSkyBlue" },
479 { RGB_TO_ULONG(70 , 130, 180), "steel blue" },
480 { RGB_TO_ULONG(70 , 130, 180), "SteelBlue" },
481 { RGB_TO_ULONG(176, 196, 222), "light steel blue" },
482 { RGB_TO_ULONG(176, 196, 222), "LightSteelBlue" },
483 { RGB_TO_ULONG(173, 216, 230), "light blue" },
484 { RGB_TO_ULONG(173, 216, 230), "LightBlue" },
485 { RGB_TO_ULONG(176, 224, 230), "powder blue" },
486 { RGB_TO_ULONG(176, 224, 230), "PowderBlue" },
487 { RGB_TO_ULONG(175, 238, 238), "pale turquoise" },
488 { RGB_TO_ULONG(175, 238, 238), "PaleTurquoise" },
489 { RGB_TO_ULONG(0 , 206, 209), "dark turquoise" },
490 { RGB_TO_ULONG(0 , 206, 209), "DarkTurquoise" },
491 { RGB_TO_ULONG(72 , 209, 204), "medium turquoise" },
492 { RGB_TO_ULONG(72 , 209, 204), "MediumTurquoise" },
493 { RGB_TO_ULONG(64 , 224, 208), "turquoise" },
494 { RGB_TO_ULONG(0 , 255, 255), "cyan" },
495 { RGB_TO_ULONG(224, 255, 255), "light cyan" },
496 { RGB_TO_ULONG(224, 255, 255), "LightCyan" },
497 { RGB_TO_ULONG(95 , 158, 160), "cadet blue" },
498 { RGB_TO_ULONG(95 , 158, 160), "CadetBlue" },
499 { RGB_TO_ULONG(102, 205, 170), "medium aquamarine" },
500 { RGB_TO_ULONG(102, 205, 170), "MediumAquamarine" },
501 { RGB_TO_ULONG(127, 255, 212), "aquamarine" },
502 { RGB_TO_ULONG(0 , 100, 0 ), "dark green" },
503 { RGB_TO_ULONG(0 , 100, 0 ), "DarkGreen" },
504 { RGB_TO_ULONG(85 , 107, 47 ), "dark olive green" },
505 { RGB_TO_ULONG(85 , 107, 47 ), "DarkOliveGreen" },
506 { RGB_TO_ULONG(143, 188, 143), "dark sea green" },
507 { RGB_TO_ULONG(143, 188, 143), "DarkSeaGreen" },
508 { RGB_TO_ULONG(46 , 139, 87 ), "sea green" },
509 { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen" },
510 { RGB_TO_ULONG(60 , 179, 113), "medium sea green" },
511 { RGB_TO_ULONG(60 , 179, 113), "MediumSeaGreen" },
512 { RGB_TO_ULONG(32 , 178, 170), "light sea green" },
513 { RGB_TO_ULONG(32 , 178, 170), "LightSeaGreen" },
514 { RGB_TO_ULONG(152, 251, 152), "pale green" },
515 { RGB_TO_ULONG(152, 251, 152), "PaleGreen" },
516 { RGB_TO_ULONG(0 , 255, 127), "spring green" },
517 { RGB_TO_ULONG(0 , 255, 127), "SpringGreen" },
518 { RGB_TO_ULONG(124, 252, 0 ), "lawn green" },
519 { RGB_TO_ULONG(124, 252, 0 ), "LawnGreen" },
520 { RGB_TO_ULONG(0 , 255, 0 ), "green" },
521 { RGB_TO_ULONG(127, 255, 0 ), "chartreuse" },
522 { RGB_TO_ULONG(0 , 250, 154), "medium spring green" },
523 { RGB_TO_ULONG(0 , 250, 154), "MediumSpringGreen" },
524 { RGB_TO_ULONG(173, 255, 47 ), "green yellow" },
525 { RGB_TO_ULONG(173, 255, 47 ), "GreenYellow" },
526 { RGB_TO_ULONG(50 , 205, 50 ), "lime green" },
527 { RGB_TO_ULONG(50 , 205, 50 ), "LimeGreen" },
528 { RGB_TO_ULONG(154, 205, 50 ), "yellow green" },
529 { RGB_TO_ULONG(154, 205, 50 ), "YellowGreen" },
530 { RGB_TO_ULONG(34 , 139, 34 ), "forest green" },
531 { RGB_TO_ULONG(34 , 139, 34 ), "ForestGreen" },
532 { RGB_TO_ULONG(107, 142, 35 ), "olive drab" },
533 { RGB_TO_ULONG(107, 142, 35 ), "OliveDrab" },
534 { RGB_TO_ULONG(189, 183, 107), "dark khaki" },
535 { RGB_TO_ULONG(189, 183, 107), "DarkKhaki" },
536 { RGB_TO_ULONG(240, 230, 140), "khaki" },
537 { RGB_TO_ULONG(238, 232, 170), "pale goldenrod" },
538 { RGB_TO_ULONG(238, 232, 170), "PaleGoldenrod" },
539 { RGB_TO_ULONG(250, 250, 210), "light goldenrod yellow" },
540 { RGB_TO_ULONG(250, 250, 210), "LightGoldenrodYellow" },
541 { RGB_TO_ULONG(255, 255, 224), "light yellow" },
542 { RGB_TO_ULONG(255, 255, 224), "LightYellow" },
543 { RGB_TO_ULONG(255, 255, 0 ), "yellow" },
544 { RGB_TO_ULONG(255, 215, 0 ), "gold" },
545 { RGB_TO_ULONG(238, 221, 130), "light goldenrod" },
546 { RGB_TO_ULONG(238, 221, 130), "LightGoldenrod" },
547 { RGB_TO_ULONG(218, 165, 32 ), "goldenrod" },
548 { RGB_TO_ULONG(184, 134, 11 ), "dark goldenrod" },
549 { RGB_TO_ULONG(184, 134, 11 ), "DarkGoldenrod" },
550 { RGB_TO_ULONG(188, 143, 143), "rosy brown" },
551 { RGB_TO_ULONG(188, 143, 143), "RosyBrown" },
552 { RGB_TO_ULONG(205, 92 , 92 ), "indian red" },
553 { RGB_TO_ULONG(205, 92 , 92 ), "IndianRed" },
554 { RGB_TO_ULONG(139, 69 , 19 ), "saddle brown" },
555 { RGB_TO_ULONG(139, 69 , 19 ), "SaddleBrown" },
556 { RGB_TO_ULONG(160, 82 , 45 ), "sienna" },
557 { RGB_TO_ULONG(205, 133, 63 ), "peru" },
558 { RGB_TO_ULONG(222, 184, 135), "burlywood" },
559 { RGB_TO_ULONG(245, 245, 220), "beige" },
560 { RGB_TO_ULONG(245, 222, 179), "wheat" },
561 { RGB_TO_ULONG(244, 164, 96 ), "sandy brown" },
562 { RGB_TO_ULONG(244, 164, 96 ), "SandyBrown" },
563 { RGB_TO_ULONG(210, 180, 140), "tan" },
564 { RGB_TO_ULONG(210, 105, 30 ), "chocolate" },
565 { RGB_TO_ULONG(178, 34 , 34 ), "firebrick" },
566 { RGB_TO_ULONG(165, 42 , 42 ), "brown" },
567 { RGB_TO_ULONG(233, 150, 122), "dark salmon" },
568 { RGB_TO_ULONG(233, 150, 122), "DarkSalmon" },
569 { RGB_TO_ULONG(250, 128, 114), "salmon" },
570 { RGB_TO_ULONG(255, 160, 122), "light salmon" },
571 { RGB_TO_ULONG(255, 160, 122), "LightSalmon" },
572 { RGB_TO_ULONG(255, 165, 0 ), "orange" },
573 { RGB_TO_ULONG(255, 140, 0 ), "dark orange" },
574 { RGB_TO_ULONG(255, 140, 0 ), "DarkOrange" },
575 { RGB_TO_ULONG(255, 127, 80 ), "coral" },
576 { RGB_TO_ULONG(240, 128, 128), "light coral" },
577 { RGB_TO_ULONG(240, 128, 128), "LightCoral" },
578 { RGB_TO_ULONG(255, 99 , 71 ), "tomato" },
579 { RGB_TO_ULONG(255, 69 , 0 ), "orange red" },
580 { RGB_TO_ULONG(255, 69 , 0 ), "OrangeRed" },
581 { RGB_TO_ULONG(255, 0 , 0 ), "red" },
582 { RGB_TO_ULONG(255, 105, 180), "hot pink" },
583 { RGB_TO_ULONG(255, 105, 180), "HotPink" },
584 { RGB_TO_ULONG(255, 20 , 147), "deep pink" },
585 { RGB_TO_ULONG(255, 20 , 147), "DeepPink" },
586 { RGB_TO_ULONG(255, 192, 203), "pink" },
587 { RGB_TO_ULONG(255, 182, 193), "light pink" },
588 { RGB_TO_ULONG(255, 182, 193), "LightPink" },
589 { RGB_TO_ULONG(219, 112, 147), "pale violet red" },
590 { RGB_TO_ULONG(219, 112, 147), "PaleVioletRed" },
591 { RGB_TO_ULONG(176, 48 , 96 ), "maroon" },
592 { RGB_TO_ULONG(199, 21 , 133), "medium violet red" },
593 { RGB_TO_ULONG(199, 21 , 133), "MediumVioletRed" },
594 { RGB_TO_ULONG(208, 32 , 144), "violet red" },
595 { RGB_TO_ULONG(208, 32 , 144), "VioletRed" },
596 { RGB_TO_ULONG(255, 0 , 255), "magenta" },
597 { RGB_TO_ULONG(238, 130, 238), "violet" },
598 { RGB_TO_ULONG(221, 160, 221), "plum" },
599 { RGB_TO_ULONG(218, 112, 214), "orchid" },
600 { RGB_TO_ULONG(186, 85 , 211), "medium orchid" },
601 { RGB_TO_ULONG(186, 85 , 211), "MediumOrchid" },
602 { RGB_TO_ULONG(153, 50 , 204), "dark orchid" },
603 { RGB_TO_ULONG(153, 50 , 204), "DarkOrchid" },
604 { RGB_TO_ULONG(148, 0 , 211), "dark violet" },
605 { RGB_TO_ULONG(148, 0 , 211), "DarkViolet" },
606 { RGB_TO_ULONG(138, 43 , 226), "blue violet" },
607 { RGB_TO_ULONG(138, 43 , 226), "BlueViolet" },
608 { RGB_TO_ULONG(160, 32 , 240), "purple" },
609 { RGB_TO_ULONG(147, 112, 219), "medium purple" },
610 { RGB_TO_ULONG(147, 112, 219), "MediumPurple" },
611 { RGB_TO_ULONG(216, 191, 216), "thistle" },
612 { RGB_TO_ULONG(255, 250, 250), "snow1" },
613 { RGB_TO_ULONG(238, 233, 233), "snow2" },
614 { RGB_TO_ULONG(205, 201, 201), "snow3" },
615 { RGB_TO_ULONG(139, 137, 137), "snow4" },
616 { RGB_TO_ULONG(255, 245, 238), "seashell1" },
617 { RGB_TO_ULONG(238, 229, 222), "seashell2" },
618 { RGB_TO_ULONG(205, 197, 191), "seashell3" },
619 { RGB_TO_ULONG(139, 134, 130), "seashell4" },
620 { RGB_TO_ULONG(255, 239, 219), "AntiqueWhite1" },
621 { RGB_TO_ULONG(238, 223, 204), "AntiqueWhite2" },
622 { RGB_TO_ULONG(205, 192, 176), "AntiqueWhite3" },
623 { RGB_TO_ULONG(139, 131, 120), "AntiqueWhite4" },
624 { RGB_TO_ULONG(255, 228, 196), "bisque1" },
625 { RGB_TO_ULONG(238, 213, 183), "bisque2" },
626 { RGB_TO_ULONG(205, 183, 158), "bisque3" },
627 { RGB_TO_ULONG(139, 125, 107), "bisque4" },
628 { RGB_TO_ULONG(255, 218, 185), "PeachPuff1" },
629 { RGB_TO_ULONG(238, 203, 173), "PeachPuff2" },
630 { RGB_TO_ULONG(205, 175, 149), "PeachPuff3" },
631 { RGB_TO_ULONG(139, 119, 101), "PeachPuff4" },
632 { RGB_TO_ULONG(255, 222, 173), "NavajoWhite1" },
633 { RGB_TO_ULONG(238, 207, 161), "NavajoWhite2" },
634 { RGB_TO_ULONG(205, 179, 139), "NavajoWhite3" },
635 { RGB_TO_ULONG(139, 121, 94), "NavajoWhite4" },
636 { RGB_TO_ULONG(255, 250, 205), "LemonChiffon1" },
637 { RGB_TO_ULONG(238, 233, 191), "LemonChiffon2" },
638 { RGB_TO_ULONG(205, 201, 165), "LemonChiffon3" },
639 { RGB_TO_ULONG(139, 137, 112), "LemonChiffon4" },
640 { RGB_TO_ULONG(255, 248, 220), "cornsilk1" },
641 { RGB_TO_ULONG(238, 232, 205), "cornsilk2" },
642 { RGB_TO_ULONG(205, 200, 177), "cornsilk3" },
643 { RGB_TO_ULONG(139, 136, 120), "cornsilk4" },
644 { RGB_TO_ULONG(255, 255, 240), "ivory1" },
645 { RGB_TO_ULONG(238, 238, 224), "ivory2" },
646 { RGB_TO_ULONG(205, 205, 193), "ivory3" },
647 { RGB_TO_ULONG(139, 139, 131), "ivory4" },
648 { RGB_TO_ULONG(240, 255, 240), "honeydew1" },
649 { RGB_TO_ULONG(224, 238, 224), "honeydew2" },
650 { RGB_TO_ULONG(193, 205, 193), "honeydew3" },
651 { RGB_TO_ULONG(131, 139, 131), "honeydew4" },
652 { RGB_TO_ULONG(255, 240, 245), "LavenderBlush1" },
653 { RGB_TO_ULONG(238, 224, 229), "LavenderBlush2" },
654 { RGB_TO_ULONG(205, 193, 197), "LavenderBlush3" },
655 { RGB_TO_ULONG(139, 131, 134), "LavenderBlush4" },
656 { RGB_TO_ULONG(255, 228, 225), "MistyRose1" },
657 { RGB_TO_ULONG(238, 213, 210), "MistyRose2" },
658 { RGB_TO_ULONG(205, 183, 181), "MistyRose3" },
659 { RGB_TO_ULONG(139, 125, 123), "MistyRose4" },
660 { RGB_TO_ULONG(240, 255, 255), "azure1" },
661 { RGB_TO_ULONG(224, 238, 238), "azure2" },
662 { RGB_TO_ULONG(193, 205, 205), "azure3" },
663 { RGB_TO_ULONG(131, 139, 139), "azure4" },
664 { RGB_TO_ULONG(131, 111, 255), "SlateBlue1" },
665 { RGB_TO_ULONG(122, 103, 238), "SlateBlue2" },
666 { RGB_TO_ULONG(105, 89 , 205), "SlateBlue3" },
667 { RGB_TO_ULONG(71 , 60 , 139), "SlateBlue4" },
668 { RGB_TO_ULONG(72 , 118, 255), "RoyalBlue1" },
669 { RGB_TO_ULONG(67 , 110, 238), "RoyalBlue2" },
670 { RGB_TO_ULONG(58 , 95 , 205), "RoyalBlue3" },
671 { RGB_TO_ULONG(39 , 64 , 139), "RoyalBlue4" },
672 { RGB_TO_ULONG(0 , 0 , 255), "blue1" },
673 { RGB_TO_ULONG(0 , 0 , 238), "blue2" },
674 { RGB_TO_ULONG(0 , 0 , 205), "blue3" },
675 { RGB_TO_ULONG(0 , 0 , 139), "blue4" },
676 { RGB_TO_ULONG(30 , 144, 255), "DodgerBlue1" },
677 { RGB_TO_ULONG(28 , 134, 238), "DodgerBlue2" },
678 { RGB_TO_ULONG(24 , 116, 205), "DodgerBlue3" },
679 { RGB_TO_ULONG(16 , 78 , 139), "DodgerBlue4" },
680 { RGB_TO_ULONG(99 , 184, 255), "SteelBlue1" },
681 { RGB_TO_ULONG(92 , 172, 238), "SteelBlue2" },
682 { RGB_TO_ULONG(79 , 148, 205), "SteelBlue3" },
683 { RGB_TO_ULONG(54 , 100, 139), "SteelBlue4" },
684 { RGB_TO_ULONG(0 , 191, 255), "DeepSkyBlue1" },
685 { RGB_TO_ULONG(0 , 178, 238), "DeepSkyBlue2" },
686 { RGB_TO_ULONG(0 , 154, 205), "DeepSkyBlue3" },
687 { RGB_TO_ULONG(0 , 104, 139), "DeepSkyBlue4" },
688 { RGB_TO_ULONG(135, 206, 255), "SkyBlue1" },
689 { RGB_TO_ULONG(126, 192, 238), "SkyBlue2" },
690 { RGB_TO_ULONG(108, 166, 205), "SkyBlue3" },
691 { RGB_TO_ULONG(74 , 112, 139), "SkyBlue4" },
692 { RGB_TO_ULONG(176, 226, 255), "LightSkyBlue1" },
693 { RGB_TO_ULONG(164, 211, 238), "LightSkyBlue2" },
694 { RGB_TO_ULONG(141, 182, 205), "LightSkyBlue3" },
695 { RGB_TO_ULONG(96 , 123, 139), "LightSkyBlue4" },
696 { RGB_TO_ULONG(198, 226, 255), "SlateGray1" },
697 { RGB_TO_ULONG(185, 211, 238), "SlateGray2" },
698 { RGB_TO_ULONG(159, 182, 205), "SlateGray3" },
699 { RGB_TO_ULONG(108, 123, 139), "SlateGray4" },
700 { RGB_TO_ULONG(202, 225, 255), "LightSteelBlue1" },
701 { RGB_TO_ULONG(188, 210, 238), "LightSteelBlue2" },
702 { RGB_TO_ULONG(162, 181, 205), "LightSteelBlue3" },
703 { RGB_TO_ULONG(110, 123, 139), "LightSteelBlue4" },
704 { RGB_TO_ULONG(191, 239, 255), "LightBlue1" },
705 { RGB_TO_ULONG(178, 223, 238), "LightBlue2" },
706 { RGB_TO_ULONG(154, 192, 205), "LightBlue3" },
707 { RGB_TO_ULONG(104, 131, 139), "LightBlue4" },
708 { RGB_TO_ULONG(224, 255, 255), "LightCyan1" },
709 { RGB_TO_ULONG(209, 238, 238), "LightCyan2" },
710 { RGB_TO_ULONG(180, 205, 205), "LightCyan3" },
711 { RGB_TO_ULONG(122, 139, 139), "LightCyan4" },
712 { RGB_TO_ULONG(187, 255, 255), "PaleTurquoise1" },
713 { RGB_TO_ULONG(174, 238, 238), "PaleTurquoise2" },
714 { RGB_TO_ULONG(150, 205, 205), "PaleTurquoise3" },
715 { RGB_TO_ULONG(102, 139, 139), "PaleTurquoise4" },
716 { RGB_TO_ULONG(152, 245, 255), "CadetBlue1" },
717 { RGB_TO_ULONG(142, 229, 238), "CadetBlue2" },
718 { RGB_TO_ULONG(122, 197, 205), "CadetBlue3" },
719 { RGB_TO_ULONG(83 , 134, 139), "CadetBlue4" },
720 { RGB_TO_ULONG(0 , 245, 255), "turquoise1" },
721 { RGB_TO_ULONG(0 , 229, 238), "turquoise2" },
722 { RGB_TO_ULONG(0 , 197, 205), "turquoise3" },
723 { RGB_TO_ULONG(0 , 134, 139), "turquoise4" },
724 { RGB_TO_ULONG(0 , 255, 255), "cyan1" },
725 { RGB_TO_ULONG(0 , 238, 238), "cyan2" },
726 { RGB_TO_ULONG(0 , 205, 205), "cyan3" },
727 { RGB_TO_ULONG(0 , 139, 139), "cyan4" },
728 { RGB_TO_ULONG(151, 255, 255), "DarkSlateGray1" },
729 { RGB_TO_ULONG(141, 238, 238), "DarkSlateGray2" },
730 { RGB_TO_ULONG(121, 205, 205), "DarkSlateGray3" },
731 { RGB_TO_ULONG(82 , 139, 139), "DarkSlateGray4" },
732 { RGB_TO_ULONG(127, 255, 212), "aquamarine1" },
733 { RGB_TO_ULONG(118, 238, 198), "aquamarine2" },
734 { RGB_TO_ULONG(102, 205, 170), "aquamarine3" },
735 { RGB_TO_ULONG(69 , 139, 116), "aquamarine4" },
736 { RGB_TO_ULONG(193, 255, 193), "DarkSeaGreen1" },
737 { RGB_TO_ULONG(180, 238, 180), "DarkSeaGreen2" },
738 { RGB_TO_ULONG(155, 205, 155), "DarkSeaGreen3" },
739 { RGB_TO_ULONG(105, 139, 105), "DarkSeaGreen4" },
740 { RGB_TO_ULONG(84 , 255, 159), "SeaGreen1" },
741 { RGB_TO_ULONG(78 , 238, 148), "SeaGreen2" },
742 { RGB_TO_ULONG(67 , 205, 128), "SeaGreen3" },
743 { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen4" },
744 { RGB_TO_ULONG(154, 255, 154), "PaleGreen1" },
745 { RGB_TO_ULONG(144, 238, 144), "PaleGreen2" },
746 { RGB_TO_ULONG(124, 205, 124), "PaleGreen3" },
747 { RGB_TO_ULONG(84 , 139, 84 ), "PaleGreen4" },
748 { RGB_TO_ULONG(0 , 255, 127), "SpringGreen1" },
749 { RGB_TO_ULONG(0 , 238, 118), "SpringGreen2" },
750 { RGB_TO_ULONG(0 , 205, 102), "SpringGreen3" },
751 { RGB_TO_ULONG(0 , 139, 69 ), "SpringGreen4" },
752 { RGB_TO_ULONG(0 , 255, 0 ), "green1" },
753 { RGB_TO_ULONG(0 , 238, 0 ), "green2" },
754 { RGB_TO_ULONG(0 , 205, 0 ), "green3" },
755 { RGB_TO_ULONG(0 , 139, 0 ), "green4" },
756 { RGB_TO_ULONG(127, 255, 0 ), "chartreuse1" },
757 { RGB_TO_ULONG(118, 238, 0 ), "chartreuse2" },
758 { RGB_TO_ULONG(102, 205, 0 ), "chartreuse3" },
759 { RGB_TO_ULONG(69 , 139, 0 ), "chartreuse4" },
760 { RGB_TO_ULONG(192, 255, 62 ), "OliveDrab1" },
761 { RGB_TO_ULONG(179, 238, 58 ), "OliveDrab2" },
762 { RGB_TO_ULONG(154, 205, 50 ), "OliveDrab3" },
763 { RGB_TO_ULONG(105, 139, 34 ), "OliveDrab4" },
764 { RGB_TO_ULONG(202, 255, 112), "DarkOliveGreen1" },
765 { RGB_TO_ULONG(188, 238, 104), "DarkOliveGreen2" },
766 { RGB_TO_ULONG(162, 205, 90 ), "DarkOliveGreen3" },
767 { RGB_TO_ULONG(110, 139, 61 ), "DarkOliveGreen4" },
768 { RGB_TO_ULONG(255, 246, 143), "khaki1" },
769 { RGB_TO_ULONG(238, 230, 133), "khaki2" },
770 { RGB_TO_ULONG(205, 198, 115), "khaki3" },
771 { RGB_TO_ULONG(139, 134, 78 ), "khaki4" },
772 { RGB_TO_ULONG(255, 236, 139), "LightGoldenrod1" },
773 { RGB_TO_ULONG(238, 220, 130), "LightGoldenrod2" },
774 { RGB_TO_ULONG(205, 190, 112), "LightGoldenrod3" },
775 { RGB_TO_ULONG(139, 129, 76 ), "LightGoldenrod4" },
776 { RGB_TO_ULONG(255, 255, 224), "LightYellow1" },
777 { RGB_TO_ULONG(238, 238, 209), "LightYellow2" },
778 { RGB_TO_ULONG(205, 205, 180), "LightYellow3" },
779 { RGB_TO_ULONG(139, 139, 122), "LightYellow4" },
780 { RGB_TO_ULONG(255, 255, 0 ), "yellow1" },
781 { RGB_TO_ULONG(238, 238, 0 ), "yellow2" },
782 { RGB_TO_ULONG(205, 205, 0 ), "yellow3" },
783 { RGB_TO_ULONG(139, 139, 0 ), "yellow4" },
784 { RGB_TO_ULONG(255, 215, 0 ), "gold1" },
785 { RGB_TO_ULONG(238, 201, 0 ), "gold2" },
786 { RGB_TO_ULONG(205, 173, 0 ), "gold3" },
787 { RGB_TO_ULONG(139, 117, 0 ), "gold4" },
788 { RGB_TO_ULONG(255, 193, 37 ), "goldenrod1" },
789 { RGB_TO_ULONG(238, 180, 34 ), "goldenrod2" },
790 { RGB_TO_ULONG(205, 155, 29 ), "goldenrod3" },
791 { RGB_TO_ULONG(139, 105, 20 ), "goldenrod4" },
792 { RGB_TO_ULONG(255, 185, 15 ), "DarkGoldenrod1" },
793 { RGB_TO_ULONG(238, 173, 14 ), "DarkGoldenrod2" },
794 { RGB_TO_ULONG(205, 149, 12 ), "DarkGoldenrod3" },
795 { RGB_TO_ULONG(139, 101, 8 ), "DarkGoldenrod4" },
796 { RGB_TO_ULONG(255, 193, 193), "RosyBrown1" },
797 { RGB_TO_ULONG(238, 180, 180), "RosyBrown2" },
798 { RGB_TO_ULONG(205, 155, 155), "RosyBrown3" },
799 { RGB_TO_ULONG(139, 105, 105), "RosyBrown4" },
800 { RGB_TO_ULONG(255, 106, 106), "IndianRed1" },
801 { RGB_TO_ULONG(238, 99 , 99 ), "IndianRed2" },
802 { RGB_TO_ULONG(205, 85 , 85 ), "IndianRed3" },
803 { RGB_TO_ULONG(139, 58 , 58 ), "IndianRed4" },
804 { RGB_TO_ULONG(255, 130, 71 ), "sienna1" },
805 { RGB_TO_ULONG(238, 121, 66 ), "sienna2" },
806 { RGB_TO_ULONG(205, 104, 57 ), "sienna3" },
807 { RGB_TO_ULONG(139, 71 , 38 ), "sienna4" },
808 { RGB_TO_ULONG(255, 211, 155), "burlywood1" },
809 { RGB_TO_ULONG(238, 197, 145), "burlywood2" },
810 { RGB_TO_ULONG(205, 170, 125), "burlywood3" },
811 { RGB_TO_ULONG(139, 115, 85 ), "burlywood4" },
812 { RGB_TO_ULONG(255, 231, 186), "wheat1" },
813 { RGB_TO_ULONG(238, 216, 174), "wheat2" },
814 { RGB_TO_ULONG(205, 186, 150), "wheat3" },
815 { RGB_TO_ULONG(139, 126, 102), "wheat4" },
816 { RGB_TO_ULONG(255, 165, 79 ), "tan1" },
817 { RGB_TO_ULONG(238, 154, 73 ), "tan2" },
818 { RGB_TO_ULONG(205, 133, 63 ), "tan3" },
819 { RGB_TO_ULONG(139, 90 , 43 ), "tan4" },
820 { RGB_TO_ULONG(255, 127, 36 ), "chocolate1" },
821 { RGB_TO_ULONG(238, 118, 33 ), "chocolate2" },
822 { RGB_TO_ULONG(205, 102, 29 ), "chocolate3" },
823 { RGB_TO_ULONG(139, 69 , 19 ), "chocolate4" },
824 { RGB_TO_ULONG(255, 48 , 48 ), "firebrick1" },
825 { RGB_TO_ULONG(238, 44 , 44 ), "firebrick2" },
826 { RGB_TO_ULONG(205, 38 , 38 ), "firebrick3" },
827 { RGB_TO_ULONG(139, 26 , 26 ), "firebrick4" },
828 { RGB_TO_ULONG(255, 64 , 64 ), "brown1" },
829 { RGB_TO_ULONG(238, 59 , 59 ), "brown2" },
830 { RGB_TO_ULONG(205, 51 , 51 ), "brown3" },
831 { RGB_TO_ULONG(139, 35 , 35 ), "brown4" },
832 { RGB_TO_ULONG(255, 140, 105), "salmon1" },
833 { RGB_TO_ULONG(238, 130, 98 ), "salmon2" },
834 { RGB_TO_ULONG(205, 112, 84 ), "salmon3" },
835 { RGB_TO_ULONG(139, 76 , 57 ), "salmon4" },
836 { RGB_TO_ULONG(255, 160, 122), "LightSalmon1" },
837 { RGB_TO_ULONG(238, 149, 114), "LightSalmon2" },
838 { RGB_TO_ULONG(205, 129, 98 ), "LightSalmon3" },
839 { RGB_TO_ULONG(139, 87 , 66 ), "LightSalmon4" },
840 { RGB_TO_ULONG(255, 165, 0 ), "orange1" },
841 { RGB_TO_ULONG(238, 154, 0 ), "orange2" },
842 { RGB_TO_ULONG(205, 133, 0 ), "orange3" },
843 { RGB_TO_ULONG(139, 90 , 0 ), "orange4" },
844 { RGB_TO_ULONG(255, 127, 0 ), "DarkOrange1" },
845 { RGB_TO_ULONG(238, 118, 0 ), "DarkOrange2" },
846 { RGB_TO_ULONG(205, 102, 0 ), "DarkOrange3" },
847 { RGB_TO_ULONG(139, 69 , 0 ), "DarkOrange4" },
848 { RGB_TO_ULONG(255, 114, 86 ), "coral1" },
849 { RGB_TO_ULONG(238, 106, 80 ), "coral2" },
850 { RGB_TO_ULONG(205, 91 , 69 ), "coral3" },
851 { RGB_TO_ULONG(139, 62 , 47 ), "coral4" },
852 { RGB_TO_ULONG(255, 99 , 71 ), "tomato1" },
853 { RGB_TO_ULONG(238, 92 , 66 ), "tomato2" },
854 { RGB_TO_ULONG(205, 79 , 57 ), "tomato3" },
855 { RGB_TO_ULONG(139, 54 , 38 ), "tomato4" },
856 { RGB_TO_ULONG(255, 69 , 0 ), "OrangeRed1" },
857 { RGB_TO_ULONG(238, 64 , 0 ), "OrangeRed2" },
858 { RGB_TO_ULONG(205, 55 , 0 ), "OrangeRed3" },
859 { RGB_TO_ULONG(139, 37 , 0 ), "OrangeRed4" },
860 { RGB_TO_ULONG(255, 0 , 0 ), "red1" },
861 { RGB_TO_ULONG(238, 0 , 0 ), "red2" },
862 { RGB_TO_ULONG(205, 0 , 0 ), "red3" },
863 { RGB_TO_ULONG(139, 0 , 0 ), "red4" },
864 { RGB_TO_ULONG(255, 20 , 147), "DeepPink1" },
865 { RGB_TO_ULONG(238, 18 , 137), "DeepPink2" },
866 { RGB_TO_ULONG(205, 16 , 118), "DeepPink3" },
867 { RGB_TO_ULONG(139, 10 , 80 ), "DeepPink4" },
868 { RGB_TO_ULONG(255, 110, 180), "HotPink1" },
869 { RGB_TO_ULONG(238, 106, 167), "HotPink2" },
870 { RGB_TO_ULONG(205, 96 , 144), "HotPink3" },
871 { RGB_TO_ULONG(139, 58 , 98 ), "HotPink4" },
872 { RGB_TO_ULONG(255, 181, 197), "pink1" },
873 { RGB_TO_ULONG(238, 169, 184), "pink2" },
874 { RGB_TO_ULONG(205, 145, 158), "pink3" },
875 { RGB_TO_ULONG(139, 99 , 108), "pink4" },
876 { RGB_TO_ULONG(255, 174, 185), "LightPink1" },
877 { RGB_TO_ULONG(238, 162, 173), "LightPink2" },
878 { RGB_TO_ULONG(205, 140, 149), "LightPink3" },
879 { RGB_TO_ULONG(139, 95 , 101), "LightPink4" },
880 { RGB_TO_ULONG(255, 130, 171), "PaleVioletRed1" },
881 { RGB_TO_ULONG(238, 121, 159), "PaleVioletRed2" },
882 { RGB_TO_ULONG(205, 104, 137), "PaleVioletRed3" },
883 { RGB_TO_ULONG(139, 71 , 93 ), "PaleVioletRed4" },
884 { RGB_TO_ULONG(255, 52 , 179), "maroon1" },
885 { RGB_TO_ULONG(238, 48 , 167), "maroon2" },
886 { RGB_TO_ULONG(205, 41 , 144), "maroon3" },
887 { RGB_TO_ULONG(139, 28 , 98 ), "maroon4" },
888 { RGB_TO_ULONG(255, 62 , 150), "VioletRed1" },
889 { RGB_TO_ULONG(238, 58 , 140), "VioletRed2" },
890 { RGB_TO_ULONG(205, 50 , 120), "VioletRed3" },
891 { RGB_TO_ULONG(139, 34 , 82 ), "VioletRed4" },
892 { RGB_TO_ULONG(255, 0 , 255), "magenta1" },
893 { RGB_TO_ULONG(238, 0 , 238), "magenta2" },
894 { RGB_TO_ULONG(205, 0 , 205), "magenta3" },
895 { RGB_TO_ULONG(139, 0 , 139), "magenta4" },
896 { RGB_TO_ULONG(255, 131, 250), "orchid1" },
897 { RGB_TO_ULONG(238, 122, 233), "orchid2" },
898 { RGB_TO_ULONG(205, 105, 201), "orchid3" },
899 { RGB_TO_ULONG(139, 71 , 137), "orchid4" },
900 { RGB_TO_ULONG(255, 187, 255), "plum1" },
901 { RGB_TO_ULONG(238, 174, 238), "plum2" },
902 { RGB_TO_ULONG(205, 150, 205), "plum3" },
903 { RGB_TO_ULONG(139, 102, 139), "plum4" },
904 { RGB_TO_ULONG(224, 102, 255), "MediumOrchid1" },
905 { RGB_TO_ULONG(209, 95 , 238), "MediumOrchid2" },
906 { RGB_TO_ULONG(180, 82 , 205), "MediumOrchid3" },
907 { RGB_TO_ULONG(122, 55 , 139), "MediumOrchid4" },
908 { RGB_TO_ULONG(191, 62 , 255), "DarkOrchid1" },
909 { RGB_TO_ULONG(178, 58 , 238), "DarkOrchid2" },
910 { RGB_TO_ULONG(154, 50 , 205), "DarkOrchid3" },
911 { RGB_TO_ULONG(104, 34 , 139), "DarkOrchid4" },
912 { RGB_TO_ULONG(155, 48 , 255), "purple1" },
913 { RGB_TO_ULONG(145, 44 , 238), "purple2" },
914 { RGB_TO_ULONG(125, 38 , 205), "purple3" },
915 { RGB_TO_ULONG(85 , 26 , 139), "purple4" },
916 { RGB_TO_ULONG(171, 130, 255), "MediumPurple1" },
917 { RGB_TO_ULONG(159, 121, 238), "MediumPurple2" },
918 { RGB_TO_ULONG(137, 104, 205), "MediumPurple3" },
919 { RGB_TO_ULONG(93 , 71 , 139), "MediumPurple4" },
920 { RGB_TO_ULONG(255, 225, 255), "thistle1" },
921 { RGB_TO_ULONG(238, 210, 238), "thistle2" },
922 { RGB_TO_ULONG(205, 181, 205), "thistle3" },
923 { RGB_TO_ULONG(139, 123, 139), "thistle4" },
924 { RGB_TO_ULONG(0 , 0 , 0 ), "gray0" },
925 { RGB_TO_ULONG(0 , 0 , 0 ), "grey0" },
926 { RGB_TO_ULONG(3 , 3 , 3 ), "gray1" },
927 { RGB_TO_ULONG(3 , 3 , 3 ), "grey1" },
928 { RGB_TO_ULONG(5 , 5 , 5 ), "gray2" },
929 { RGB_TO_ULONG(5 , 5 , 5 ), "grey2" },
930 { RGB_TO_ULONG(8 , 8 , 8 ), "gray3" },
931 { RGB_TO_ULONG(8 , 8 , 8 ), "grey3" },
932 { RGB_TO_ULONG(10 , 10 , 10 ), "gray4" },
933 { RGB_TO_ULONG(10 , 10 , 10 ), "grey4" },
934 { RGB_TO_ULONG(13 , 13 , 13 ), "gray5" },
935 { RGB_TO_ULONG(13 , 13 , 13 ), "grey5" },
936 { RGB_TO_ULONG(15 , 15 , 15 ), "gray6" },
937 { RGB_TO_ULONG(15 , 15 , 15 ), "grey6" },
938 { RGB_TO_ULONG(18 , 18 , 18 ), "gray7" },
939 { RGB_TO_ULONG(18 , 18 , 18 ), "grey7" },
940 { RGB_TO_ULONG(20 , 20 , 20 ), "gray8" },
941 { RGB_TO_ULONG(20 , 20 , 20 ), "grey8" },
942 { RGB_TO_ULONG(23 , 23 , 23 ), "gray9" },
943 { RGB_TO_ULONG(23 , 23 , 23 ), "grey9" },
944 { RGB_TO_ULONG(26 , 26 , 26 ), "gray10" },
945 { RGB_TO_ULONG(26 , 26 , 26 ), "grey10" },
946 { RGB_TO_ULONG(28 , 28 , 28 ), "gray11" },
947 { RGB_TO_ULONG(28 , 28 , 28 ), "grey11" },
948 { RGB_TO_ULONG(31 , 31 , 31 ), "gray12" },
949 { RGB_TO_ULONG(31 , 31 , 31 ), "grey12" },
950 { RGB_TO_ULONG(33 , 33 , 33 ), "gray13" },
951 { RGB_TO_ULONG(33 , 33 , 33 ), "grey13" },
952 { RGB_TO_ULONG(36 , 36 , 36 ), "gray14" },
953 { RGB_TO_ULONG(36 , 36 , 36 ), "grey14" },
954 { RGB_TO_ULONG(38 , 38 , 38 ), "gray15" },
955 { RGB_TO_ULONG(38 , 38 , 38 ), "grey15" },
956 { RGB_TO_ULONG(41 , 41 , 41 ), "gray16" },
957 { RGB_TO_ULONG(41 , 41 , 41 ), "grey16" },
958 { RGB_TO_ULONG(43 , 43 , 43 ), "gray17" },
959 { RGB_TO_ULONG(43 , 43 , 43 ), "grey17" },
960 { RGB_TO_ULONG(46 , 46 , 46 ), "gray18" },
961 { RGB_TO_ULONG(46 , 46 , 46 ), "grey18" },
962 { RGB_TO_ULONG(48 , 48 , 48 ), "gray19" },
963 { RGB_TO_ULONG(48 , 48 , 48 ), "grey19" },
964 { RGB_TO_ULONG(51 , 51 , 51 ), "gray20" },
965 { RGB_TO_ULONG(51 , 51 , 51 ), "grey20" },
966 { RGB_TO_ULONG(54 , 54 , 54 ), "gray21" },
967 { RGB_TO_ULONG(54 , 54 , 54 ), "grey21" },
968 { RGB_TO_ULONG(56 , 56 , 56 ), "gray22" },
969 { RGB_TO_ULONG(56 , 56 , 56 ), "grey22" },
970 { RGB_TO_ULONG(59 , 59 , 59 ), "gray23" },
971 { RGB_TO_ULONG(59 , 59 , 59 ), "grey23" },
972 { RGB_TO_ULONG(61 , 61 , 61 ), "gray24" },
973 { RGB_TO_ULONG(61 , 61 , 61 ), "grey24" },
974 { RGB_TO_ULONG(64 , 64 , 64 ), "gray25" },
975 { RGB_TO_ULONG(64 , 64 , 64 ), "grey25" },
976 { RGB_TO_ULONG(66 , 66 , 66 ), "gray26" },
977 { RGB_TO_ULONG(66 , 66 , 66 ), "grey26" },
978 { RGB_TO_ULONG(69 , 69 , 69 ), "gray27" },
979 { RGB_TO_ULONG(69 , 69 , 69 ), "grey27" },
980 { RGB_TO_ULONG(71 , 71 , 71 ), "gray28" },
981 { RGB_TO_ULONG(71 , 71 , 71 ), "grey28" },
982 { RGB_TO_ULONG(74 , 74 , 74 ), "gray29" },
983 { RGB_TO_ULONG(74 , 74 , 74 ), "grey29" },
984 { RGB_TO_ULONG(77 , 77 , 77 ), "gray30" },
985 { RGB_TO_ULONG(77 , 77 , 77 ), "grey30" },
986 { RGB_TO_ULONG(79 , 79 , 79 ), "gray31" },
987 { RGB_TO_ULONG(79 , 79 , 79 ), "grey31" },
988 { RGB_TO_ULONG(82 , 82 , 82 ), "gray32" },
989 { RGB_TO_ULONG(82 , 82 , 82 ), "grey32" },
990 { RGB_TO_ULONG(84 , 84 , 84 ), "gray33" },
991 { RGB_TO_ULONG(84 , 84 , 84 ), "grey33" },
992 { RGB_TO_ULONG(87 , 87 , 87 ), "gray34" },
993 { RGB_TO_ULONG(87 , 87 , 87 ), "grey34" },
994 { RGB_TO_ULONG(89 , 89 , 89 ), "gray35" },
995 { RGB_TO_ULONG(89 , 89 , 89 ), "grey35" },
996 { RGB_TO_ULONG(92 , 92 , 92 ), "gray36" },
997 { RGB_TO_ULONG(92 , 92 , 92 ), "grey36" },
998 { RGB_TO_ULONG(94 , 94 , 94 ), "gray37" },
999 { RGB_TO_ULONG(94 , 94 , 94 ), "grey37" },
1000 { RGB_TO_ULONG(97 , 97 , 97 ), "gray38" },
1001 { RGB_TO_ULONG(97 , 97 , 97 ), "grey38" },
1002 { RGB_TO_ULONG(99 , 99 , 99 ), "gray39" },
1003 { RGB_TO_ULONG(99 , 99 , 99 ), "grey39" },
1004 { RGB_TO_ULONG(102, 102, 102), "gray40" },
1005 { RGB_TO_ULONG(102, 102, 102), "grey40" },
1006 { RGB_TO_ULONG(105, 105, 105), "gray41" },
1007 { RGB_TO_ULONG(105, 105, 105), "grey41" },
1008 { RGB_TO_ULONG(107, 107, 107), "gray42" },
1009 { RGB_TO_ULONG(107, 107, 107), "grey42" },
1010 { RGB_TO_ULONG(110, 110, 110), "gray43" },
1011 { RGB_TO_ULONG(110, 110, 110), "grey43" },
1012 { RGB_TO_ULONG(112, 112, 112), "gray44" },
1013 { RGB_TO_ULONG(112, 112, 112), "grey44" },
1014 { RGB_TO_ULONG(115, 115, 115), "gray45" },
1015 { RGB_TO_ULONG(115, 115, 115), "grey45" },
1016 { RGB_TO_ULONG(117, 117, 117), "gray46" },
1017 { RGB_TO_ULONG(117, 117, 117), "grey46" },
1018 { RGB_TO_ULONG(120, 120, 120), "gray47" },
1019 { RGB_TO_ULONG(120, 120, 120), "grey47" },
1020 { RGB_TO_ULONG(122, 122, 122), "gray48" },
1021 { RGB_TO_ULONG(122, 122, 122), "grey48" },
1022 { RGB_TO_ULONG(125, 125, 125), "gray49" },
1023 { RGB_TO_ULONG(125, 125, 125), "grey49" },
1024 { RGB_TO_ULONG(127, 127, 127), "gray50" },
1025 { RGB_TO_ULONG(127, 127, 127), "grey50" },
1026 { RGB_TO_ULONG(130, 130, 130), "gray51" },
1027 { RGB_TO_ULONG(130, 130, 130), "grey51" },
1028 { RGB_TO_ULONG(133, 133, 133), "gray52" },
1029 { RGB_TO_ULONG(133, 133, 133), "grey52" },
1030 { RGB_TO_ULONG(135, 135, 135), "gray53" },
1031 { RGB_TO_ULONG(135, 135, 135), "grey53" },
1032 { RGB_TO_ULONG(138, 138, 138), "gray54" },
1033 { RGB_TO_ULONG(138, 138, 138), "grey54" },
1034 { RGB_TO_ULONG(140, 140, 140), "gray55" },
1035 { RGB_TO_ULONG(140, 140, 140), "grey55" },
1036 { RGB_TO_ULONG(143, 143, 143), "gray56" },
1037 { RGB_TO_ULONG(143, 143, 143), "grey56" },
1038 { RGB_TO_ULONG(145, 145, 145), "gray57" },
1039 { RGB_TO_ULONG(145, 145, 145), "grey57" },
1040 { RGB_TO_ULONG(148, 148, 148), "gray58" },
1041 { RGB_TO_ULONG(148, 148, 148), "grey58" },
1042 { RGB_TO_ULONG(150, 150, 150), "gray59" },
1043 { RGB_TO_ULONG(150, 150, 150), "grey59" },
1044 { RGB_TO_ULONG(153, 153, 153), "gray60" },
1045 { RGB_TO_ULONG(153, 153, 153), "grey60" },
1046 { RGB_TO_ULONG(156, 156, 156), "gray61" },
1047 { RGB_TO_ULONG(156, 156, 156), "grey61" },
1048 { RGB_TO_ULONG(158, 158, 158), "gray62" },
1049 { RGB_TO_ULONG(158, 158, 158), "grey62" },
1050 { RGB_TO_ULONG(161, 161, 161), "gray63" },
1051 { RGB_TO_ULONG(161, 161, 161), "grey63" },
1052 { RGB_TO_ULONG(163, 163, 163), "gray64" },
1053 { RGB_TO_ULONG(163, 163, 163), "grey64" },
1054 { RGB_TO_ULONG(166, 166, 166), "gray65" },
1055 { RGB_TO_ULONG(166, 166, 166), "grey65" },
1056 { RGB_TO_ULONG(168, 168, 168), "gray66" },
1057 { RGB_TO_ULONG(168, 168, 168), "grey66" },
1058 { RGB_TO_ULONG(171, 171, 171), "gray67" },
1059 { RGB_TO_ULONG(171, 171, 171), "grey67" },
1060 { RGB_TO_ULONG(173, 173, 173), "gray68" },
1061 { RGB_TO_ULONG(173, 173, 173), "grey68" },
1062 { RGB_TO_ULONG(176, 176, 176), "gray69" },
1063 { RGB_TO_ULONG(176, 176, 176), "grey69" },
1064 { RGB_TO_ULONG(179, 179, 179), "gray70" },
1065 { RGB_TO_ULONG(179, 179, 179), "grey70" },
1066 { RGB_TO_ULONG(181, 181, 181), "gray71" },
1067 { RGB_TO_ULONG(181, 181, 181), "grey71" },
1068 { RGB_TO_ULONG(184, 184, 184), "gray72" },
1069 { RGB_TO_ULONG(184, 184, 184), "grey72" },
1070 { RGB_TO_ULONG(186, 186, 186), "gray73" },
1071 { RGB_TO_ULONG(186, 186, 186), "grey73" },
1072 { RGB_TO_ULONG(189, 189, 189), "gray74" },
1073 { RGB_TO_ULONG(189, 189, 189), "grey74" },
1074 { RGB_TO_ULONG(191, 191, 191), "gray75" },
1075 { RGB_TO_ULONG(191, 191, 191), "grey75" },
1076 { RGB_TO_ULONG(194, 194, 194), "gray76" },
1077 { RGB_TO_ULONG(194, 194, 194), "grey76" },
1078 { RGB_TO_ULONG(196, 196, 196), "gray77" },
1079 { RGB_TO_ULONG(196, 196, 196), "grey77" },
1080 { RGB_TO_ULONG(199, 199, 199), "gray78" },
1081 { RGB_TO_ULONG(199, 199, 199), "grey78" },
1082 { RGB_TO_ULONG(201, 201, 201), "gray79" },
1083 { RGB_TO_ULONG(201, 201, 201), "grey79" },
1084 { RGB_TO_ULONG(204, 204, 204), "gray80" },
1085 { RGB_TO_ULONG(204, 204, 204), "grey80" },
1086 { RGB_TO_ULONG(207, 207, 207), "gray81" },
1087 { RGB_TO_ULONG(207, 207, 207), "grey81" },
1088 { RGB_TO_ULONG(209, 209, 209), "gray82" },
1089 { RGB_TO_ULONG(209, 209, 209), "grey82" },
1090 { RGB_TO_ULONG(212, 212, 212), "gray83" },
1091 { RGB_TO_ULONG(212, 212, 212), "grey83" },
1092 { RGB_TO_ULONG(214, 214, 214), "gray84" },
1093 { RGB_TO_ULONG(214, 214, 214), "grey84" },
1094 { RGB_TO_ULONG(217, 217, 217), "gray85" },
1095 { RGB_TO_ULONG(217, 217, 217), "grey85" },
1096 { RGB_TO_ULONG(219, 219, 219), "gray86" },
1097 { RGB_TO_ULONG(219, 219, 219), "grey86" },
1098 { RGB_TO_ULONG(222, 222, 222), "gray87" },
1099 { RGB_TO_ULONG(222, 222, 222), "grey87" },
1100 { RGB_TO_ULONG(224, 224, 224), "gray88" },
1101 { RGB_TO_ULONG(224, 224, 224), "grey88" },
1102 { RGB_TO_ULONG(227, 227, 227), "gray89" },
1103 { RGB_TO_ULONG(227, 227, 227), "grey89" },
1104 { RGB_TO_ULONG(229, 229, 229), "gray90" },
1105 { RGB_TO_ULONG(229, 229, 229), "grey90" },
1106 { RGB_TO_ULONG(232, 232, 232), "gray91" },
1107 { RGB_TO_ULONG(232, 232, 232), "grey91" },
1108 { RGB_TO_ULONG(235, 235, 235), "gray92" },
1109 { RGB_TO_ULONG(235, 235, 235), "grey92" },
1110 { RGB_TO_ULONG(237, 237, 237), "gray93" },
1111 { RGB_TO_ULONG(237, 237, 237), "grey93" },
1112 { RGB_TO_ULONG(240, 240, 240), "gray94" },
1113 { RGB_TO_ULONG(240, 240, 240), "grey94" },
1114 { RGB_TO_ULONG(242, 242, 242), "gray95" },
1115 { RGB_TO_ULONG(242, 242, 242), "grey95" },
1116 { RGB_TO_ULONG(245, 245, 245), "gray96" },
1117 { RGB_TO_ULONG(245, 245, 245), "grey96" },
1118 { RGB_TO_ULONG(247, 247, 247), "gray97" },
1119 { RGB_TO_ULONG(247, 247, 247), "grey97" },
1120 { RGB_TO_ULONG(250, 250, 250), "gray98" },
1121 { RGB_TO_ULONG(250, 250, 250), "grey98" },
1122 { RGB_TO_ULONG(252, 252, 252), "gray99" },
1123 { RGB_TO_ULONG(252, 252, 252), "grey99" },
1124 { RGB_TO_ULONG(255, 255, 255), "gray100" },
1125 { RGB_TO_ULONG(255, 255, 255), "grey100" },
1126 { RGB_TO_ULONG(169, 169, 169), "dark grey" },
1127 { RGB_TO_ULONG(169, 169, 169), "DarkGrey" },
1128 { RGB_TO_ULONG(169, 169, 169), "dark gray" },
1129 { RGB_TO_ULONG(169, 169, 169), "DarkGray" },
1130 { RGB_TO_ULONG(0 , 0 , 139), "dark blue" },
1131 { RGB_TO_ULONG(0 , 0 , 139), "DarkBlue" },
1132 { RGB_TO_ULONG(0 , 139, 139), "dark cyan" },
1133 { RGB_TO_ULONG(0 , 139, 139), "DarkCyan" },
1134 { RGB_TO_ULONG(139, 0 , 139), "dark magenta" },
1135 { RGB_TO_ULONG(139, 0 , 139), "DarkMagenta" },
1136 { RGB_TO_ULONG(139, 0 , 0 ), "dark red" },
1137 { RGB_TO_ULONG(139, 0 , 0 ), "DarkRed" },
1138 { RGB_TO_ULONG(144, 238, 144), "light green" },
1139 { RGB_TO_ULONG(144, 238, 144), "LightGreen" }
1143 mac_color_map_lookup (colorname
)
1146 Lisp_Object ret
= Qnil
;
1151 for (i
= 0; i
< sizeof (mac_color_map
) / sizeof (mac_color_map
[0]); i
++)
1152 if (stricmp (colorname
, mac_color_map
[i
].name
) == 0)
1154 ret
= make_number (mac_color_map
[i
].color
);
1164 x_to_mac_color (colorname
)
1167 register Lisp_Object tail
, ret
= Qnil
;
1171 if (colorname
[0] == '#')
1173 /* Could be an old-style RGB Device specification. */
1176 color
= colorname
+ 1;
1178 size
= strlen(color
);
1179 if (size
== 3 || size
== 6 || size
== 9 || size
== 12)
1181 unsigned long colorval
;
1187 for (i
= 0; i
< 3; i
++)
1191 unsigned long value
;
1193 /* The check for 'x' in the following conditional takes into
1194 account the fact that strtol allows a "0x" in front of
1195 our numbers, and we don't. */
1196 if (!isxdigit(color
[0]) || color
[1] == 'x')
1200 value
= strtoul(color
, &end
, 16);
1202 if (errno
== ERANGE
|| end
- color
!= size
)
1207 value
= value
* 0x10;
1218 colorval
|= (value
<< pos
);
1223 return make_number (colorval
);
1229 else if (strnicmp(colorname
, "rgb:", 4) == 0)
1232 unsigned long colorval
;
1237 color
= colorname
+ 4;
1238 for (i
= 0; i
< 3; i
++)
1241 unsigned long value
;
1243 /* The check for 'x' in the following conditional takes into
1244 account the fact that strtol allows a "0x" in front of
1245 our numbers, and we don't. */
1246 if (!isxdigit(color
[0]) || color
[1] == 'x')
1248 value
= strtoul(color
, &end
, 16);
1249 if (errno
== ERANGE
)
1251 switch (end
- color
)
1254 value
= value
* 0x10 + value
;
1267 if (value
== ULONG_MAX
)
1269 colorval
|= (value
<< pos
);
1276 return make_number (colorval
);
1283 else if (strnicmp(colorname
, "rgbi:", 5) == 0)
1285 /* This is an RGB Intensity specification. */
1287 unsigned long colorval
;
1292 color
= colorname
+ 5;
1293 for (i
= 0; i
< 3; i
++)
1299 value
= strtod(color
, &end
);
1300 if (errno
== ERANGE
)
1302 if (value
< 0.0 || value
> 1.0)
1304 val
= (unsigned long)(0x100 * value
);
1305 /* We used 0x100 instead of 0xFF to give a continuous
1306 range between 0.0 and 1.0 inclusive. The next statement
1307 fixes the 1.0 case. */
1310 colorval
|= (val
<< pos
);
1317 return make_number (colorval
);
1325 ret
= mac_color_map_lookup (colorname
);
1331 /* Gamma-correct COLOR on frame F. */
1334 gamma_correct (f
, color
)
1336 unsigned long *color
;
1340 unsigned long red
, green
, blue
;
1342 red
= pow (RED_FROM_ULONG (*color
) / 255.0, f
->gamma
) * 255.0 + 0.5;
1343 green
= pow (GREEN_FROM_ULONG (*color
) / 255.0, f
->gamma
) * 255.0 + 0.5;
1344 blue
= pow (BLUE_FROM_ULONG (*color
) / 255.0, f
->gamma
) * 255.0 + 0.5;
1345 *color
= RGB_TO_ULONG (red
, green
, blue
);
1349 /* Decide if color named COLOR is valid for the display associated
1350 with the selected frame; if so, return the rgb values in COLOR_DEF.
1351 If ALLOC is nonzero, allocate a new colormap cell. */
1354 mac_defined_color (f
, color
, color_def
, alloc
)
1360 register Lisp_Object tem
;
1361 unsigned long mac_color_ref
;
1363 tem
= x_to_mac_color (color
);
1369 /* Apply gamma correction. */
1370 mac_color_ref
= XUINT (tem
);
1371 gamma_correct (f
, &mac_color_ref
);
1372 XSETINT (tem
, mac_color_ref
);
1375 color_def
->pixel
= mac_color_ref
;
1376 color_def
->red
= RED16_FROM_ULONG (mac_color_ref
);
1377 color_def
->green
= GREEN16_FROM_ULONG (mac_color_ref
);
1378 color_def
->blue
= BLUE16_FROM_ULONG (mac_color_ref
);
1388 /* Given a string ARG naming a color, compute a pixel value from it
1389 suitable for screen F.
1390 If F is not a color screen, return DEF (default) regardless of what
1394 x_decode_color (f
, arg
, def
)
1403 if (strcmp (SDATA (arg
), "black") == 0)
1404 return BLACK_PIX_DEFAULT (f
);
1405 else if (strcmp (SDATA (arg
), "white") == 0)
1406 return WHITE_PIX_DEFAULT (f
);
1409 if (FRAME_MAC_DISPLAY_INFO (f
)->n_planes
) == 1)
1413 if (mac_defined_color (f
, SDATA (arg
), &cdef
, 1))
1416 /* defined_color failed; return an ultimate default. */
1420 /* Functions called only from `x_set_frame_param'
1421 to set individual parameters.
1423 If FRAME_MAC_WINDOW (f) is 0,
1424 the frame is being created and its window does not exist yet.
1425 In that case, just record the parameter's new value
1426 in the standard place; do not attempt to change the window. */
1429 x_set_foreground_color (f
, arg
, oldval
)
1431 Lisp_Object arg
, oldval
;
1433 unsigned long fg
, old_fg
;
1435 fg
= x_decode_color (f
, arg
, BLACK_PIX_DEFAULT (f
));
1436 old_fg
= FRAME_FOREGROUND_PIXEL (f
);
1437 FRAME_FOREGROUND_PIXEL (f
) = fg
;
1439 if (FRAME_MAC_WINDOW (f
) != 0)
1441 update_face_from_frame_parameter (f
, Qforeground_color
, arg
);
1442 if (FRAME_VISIBLE_P (f
))
1448 x_set_background_color (f
, arg
, oldval
)
1450 Lisp_Object arg
, oldval
;
1452 FRAME_BACKGROUND_PIXEL (f
)
1453 = x_decode_color (f
, arg
, WHITE_PIX_DEFAULT (f
));
1455 if (FRAME_MAC_WINDOW (f
) != 0)
1457 update_face_from_frame_parameter (f
, Qbackground_color
, arg
);
1459 if (FRAME_VISIBLE_P (f
))
1465 x_set_mouse_color (f
, arg
, oldval
)
1467 Lisp_Object arg
, oldval
;
1469 Cursor cursor
, nontext_cursor
, mode_cursor
, hand_cursor
;
1473 if (!EQ (Qnil
, arg
))
1474 f
->output_data
.mac
->mouse_pixel
1475 = x_decode_color (f
, arg
, BLACK_PIX_DEFAULT (f
));
1476 mask_color
= FRAME_BACKGROUND_PIXEL (f
);
1478 /* Don't let pointers be invisible. */
1479 if (mask_color
== f
->output_data
.mac
->mouse_pixel
1480 && mask_color
== FRAME_BACKGROUND_PIXEL (f
))
1481 f
->output_data
.mac
->mouse_pixel
= FRAME_FOREGROUND_PIXEL (f
);
1483 #if 0 /* MAC_TODO : cursor changes */
1486 /* It's not okay to crash if the user selects a screwy cursor. */
1487 count
= x_catch_errors (FRAME_W32_DISPLAY (f
));
1489 if (!EQ (Qnil
, Vx_pointer_shape
))
1491 CHECK_NUMBER (Vx_pointer_shape
);
1492 cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XINT (Vx_pointer_shape
));
1495 cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_xterm
);
1496 x_check_errors (FRAME_W32_DISPLAY (f
), "bad text pointer cursor: %s");
1498 if (!EQ (Qnil
, Vx_nontext_pointer_shape
))
1500 CHECK_NUMBER (Vx_nontext_pointer_shape
);
1501 nontext_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1502 XINT (Vx_nontext_pointer_shape
));
1505 nontext_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_left_ptr
);
1506 x_check_errors (FRAME_W32_DISPLAY (f
), "bad nontext pointer cursor: %s");
1508 if (!EQ (Qnil
, Vx_hourglass_pointer_shape
))
1510 CHECK_NUMBER (Vx_hourglass_pointer_shape
);
1511 hourglass_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1512 XINT (Vx_hourglass_pointer_shape
));
1515 hourglass_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_watch
);
1516 x_check_errors (FRAME_W32_DISPLAY (f
), "bad busy pointer cursor: %s");
1518 x_check_errors (FRAME_W32_DISPLAY (f
), "bad nontext pointer cursor: %s");
1519 if (!EQ (Qnil
, Vx_mode_pointer_shape
))
1521 CHECK_NUMBER (Vx_mode_pointer_shape
);
1522 mode_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1523 XINT (Vx_mode_pointer_shape
));
1526 mode_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_xterm
);
1527 x_check_errors (FRAME_W32_DISPLAY (f
), "bad modeline pointer cursor: %s");
1529 if (!EQ (Qnil
, Vx_sensitive_text_pointer_shape
))
1531 CHECK_NUMBER (Vx_sensitive_text_pointer_shape
);
1533 = XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1534 XINT (Vx_sensitive_text_pointer_shape
));
1537 hand_cursor
= XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_crosshair
);
1539 if (!NILP (Vx_window_horizontal_drag_shape
))
1541 CHECK_NUMBER (Vx_window_horizontal_drag_shape
);
1542 horizontal_drag_cursor
1543 = XCreateFontCursor (FRAME_W32_DISPLAY (f
),
1544 XINT (Vx_window_horizontal_drag_shape
));
1547 horizontal_drag_cursor
1548 = XCreateFontCursor (FRAME_W32_DISPLAY (f
), XC_sb_h_double_arrow
);
1550 /* Check and report errors with the above calls. */
1551 x_check_errors (FRAME_W32_DISPLAY (f
), "can't set cursor shape: %s");
1552 x_uncatch_errors (FRAME_W32_DISPLAY (f
), count
);
1555 XColor fore_color
, back_color
;
1557 fore_color
.pixel
= f
->output_data
.w32
->mouse_pixel
;
1558 back_color
.pixel
= mask_color
;
1559 XQueryColor (FRAME_W32_DISPLAY (f
),
1560 DefaultColormap (FRAME_W32_DISPLAY (f
),
1561 DefaultScreen (FRAME_W32_DISPLAY (f
))),
1563 XQueryColor (FRAME_W32_DISPLAY (f
),
1564 DefaultColormap (FRAME_W32_DISPLAY (f
),
1565 DefaultScreen (FRAME_W32_DISPLAY (f
))),
1567 XRecolorCursor (FRAME_W32_DISPLAY (f
), cursor
,
1568 &fore_color
, &back_color
);
1569 XRecolorCursor (FRAME_W32_DISPLAY (f
), nontext_cursor
,
1570 &fore_color
, &back_color
);
1571 XRecolorCursor (FRAME_W32_DISPLAY (f
), mode_cursor
,
1572 &fore_color
, &back_color
);
1573 XRecolorCursor (FRAME_W32_DISPLAY (f
), hand_cursor
,
1574 &fore_color
, &back_color
);
1575 XRecolorCursor (FRAME_W32_DISPLAY (f
), hourglass_cursor
,
1576 &fore_color
, &back_color
);
1579 if (FRAME_W32_WINDOW (f
) != 0)
1580 XDefineCursor (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
), cursor
);
1582 if (cursor
!= f
->output_data
.w32
->text_cursor
&& f
->output_data
.w32
->text_cursor
!= 0)
1583 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->text_cursor
);
1584 f
->output_data
.w32
->text_cursor
= cursor
;
1586 if (nontext_cursor
!= f
->output_data
.w32
->nontext_cursor
1587 && f
->output_data
.w32
->nontext_cursor
!= 0)
1588 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->nontext_cursor
);
1589 f
->output_data
.w32
->nontext_cursor
= nontext_cursor
;
1591 if (hourglass_cursor
!= f
->output_data
.w32
->hourglass_cursor
1592 && f
->output_data
.w32
->hourglass_cursor
!= 0)
1593 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->hourglass_cursor
);
1594 f
->output_data
.w32
->hourglass_cursor
= hourglass_cursor
;
1596 if (mode_cursor
!= f
->output_data
.w32
->modeline_cursor
1597 && f
->output_data
.w32
->modeline_cursor
!= 0)
1598 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->modeline_cursor
);
1599 f
->output_data
.w32
->modeline_cursor
= mode_cursor
;
1601 if (hand_cursor
!= f
->output_data
.w32
->hand_cursor
1602 && f
->output_data
.w32
->hand_cursor
!= 0)
1603 XFreeCursor (FRAME_W32_DISPLAY (f
), f
->output_data
.w32
->hand_cursor
);
1604 f
->output_data
.w32
->hand_cursor
= hand_cursor
;
1606 XFlush (FRAME_W32_DISPLAY (f
));
1609 update_face_from_frame_parameter (f
, Qmouse_color
, arg
);
1610 #endif /* MAC_TODO */
1614 x_set_cursor_color (f
, arg
, oldval
)
1616 Lisp_Object arg
, oldval
;
1618 unsigned long fore_pixel
, pixel
;
1620 if (!NILP (Vx_cursor_fore_pixel
))
1621 fore_pixel
= x_decode_color (f
, Vx_cursor_fore_pixel
,
1622 WHITE_PIX_DEFAULT (f
));
1624 fore_pixel
= FRAME_BACKGROUND_PIXEL (f
);
1626 pixel
= x_decode_color (f
, arg
, BLACK_PIX_DEFAULT (f
));
1628 /* Make sure that the cursor color differs from the background color. */
1629 if (pixel
== FRAME_BACKGROUND_PIXEL (f
))
1631 pixel
= f
->output_data
.mac
->mouse_pixel
;
1632 if (pixel
== fore_pixel
)
1633 fore_pixel
= FRAME_BACKGROUND_PIXEL (f
);
1636 f
->output_data
.mac
->cursor_foreground_pixel
= fore_pixel
;
1637 f
->output_data
.mac
->cursor_pixel
= pixel
;
1639 if (FRAME_MAC_WINDOW (f
) != 0)
1642 /* Update frame's cursor_gc. */
1643 f
->output_data
.mac
->cursor_gc
->foreground
= fore_pixel
;
1644 f
->output_data
.mac
->cursor_gc
->background
= pixel
;
1648 if (FRAME_VISIBLE_P (f
))
1650 x_update_cursor (f
, 0);
1651 x_update_cursor (f
, 1);
1655 update_face_from_frame_parameter (f
, Qcursor_color
, arg
);
1658 /* Set the border-color of frame F to pixel value PIX.
1659 Note that this does not fully take effect if done before
1663 x_set_border_pixel (f
, pix
)
1668 f
->output_data
.mac
->border_pixel
= pix
;
1670 if (FRAME_MAC_WINDOW (f
) != 0 && f
->border_width
> 0)
1672 if (FRAME_VISIBLE_P (f
))
1677 /* Set the border-color of frame F to value described by ARG.
1678 ARG can be a string naming a color.
1679 The border-color is used for the border that is drawn by the server.
1680 Note that this does not fully take effect if done before
1681 F has a window; it must be redone when the window is created. */
1684 x_set_border_color (f
, arg
, oldval
)
1686 Lisp_Object arg
, oldval
;
1691 pix
= x_decode_color (f
, arg
, BLACK_PIX_DEFAULT (f
));
1692 x_set_border_pixel (f
, pix
);
1693 update_face_from_frame_parameter (f
, Qborder_color
, arg
);
1698 x_set_cursor_type (f
, arg
, oldval
)
1700 Lisp_Object arg
, oldval
;
1702 set_frame_cursor_types (f
, arg
);
1704 /* Make sure the cursor gets redrawn. */
1705 cursor_type_changed
= 1;
1708 #if 0 /* MAC_TODO: really no icon for Mac */
1710 x_set_icon_type (f
, arg
, oldval
)
1712 Lisp_Object arg
, oldval
;
1716 if (NILP (arg
) && NILP (oldval
))
1719 if (STRINGP (arg
) && STRINGP (oldval
)
1720 && EQ (Fstring_equal (oldval
, arg
), Qt
))
1723 if (SYMBOLP (arg
) && SYMBOLP (oldval
) && EQ (arg
, oldval
))
1728 result
= x_bitmap_icon (f
, arg
);
1732 error ("No icon window available");
1737 #endif /* MAC_TODO */
1740 x_set_icon_name (f
, arg
, oldval
)
1742 Lisp_Object arg
, oldval
;
1748 if (STRINGP (oldval
) && EQ (Fstring_equal (oldval
, arg
), Qt
))
1751 else if (!STRINGP (oldval
) && EQ (oldval
, Qnil
) == EQ (arg
, Qnil
))
1756 #if 0 /* MAC_TODO */
1757 if (f
->output_data
.w32
->icon_bitmap
!= 0)
1762 result
= x_text_icon (f
,
1763 (char *) SDATA ((!NILP (f
->icon_name
)
1772 error ("No icon window available");
1775 /* If the window was unmapped (and its icon was mapped),
1776 the new icon is not mapped, so map the window in its stead. */
1777 if (FRAME_VISIBLE_P (f
))
1779 #ifdef USE_X_TOOLKIT
1780 XtPopup (f
->output_data
.w32
->widget
, XtGrabNone
);
1782 XMapWindow (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
));
1785 XFlush (FRAME_W32_DISPLAY (f
));
1787 #endif /* MAC_TODO */
1792 x_set_menu_bar_lines (f
, value
, oldval
)
1794 Lisp_Object value
, oldval
;
1797 int olines
= FRAME_MENU_BAR_LINES (f
);
1799 /* Right now, menu bars don't work properly in minibuf-only frames;
1800 most of the commands try to apply themselves to the minibuffer
1801 frame itself, and get an error because you can't switch buffers
1802 in or split the minibuffer window. */
1803 if (FRAME_MINIBUF_ONLY_P (f
))
1806 if (INTEGERP (value
))
1807 nlines
= XINT (value
);
1811 FRAME_MENU_BAR_LINES (f
) = 0;
1813 FRAME_EXTERNAL_MENU_BAR (f
) = 1;
1816 if (FRAME_EXTERNAL_MENU_BAR (f
) == 1)
1817 free_frame_menubar (f
);
1818 FRAME_EXTERNAL_MENU_BAR (f
) = 0;
1820 /* Adjust the frame size so that the client (text) dimensions
1821 remain the same. This depends on FRAME_EXTERNAL_MENU_BAR being
1823 x_set_window_size (f
, 0, FRAME_COLS (f
), FRAME_LINES (f
));
1824 do_pending_window_change (0);
1830 /* Set the number of lines used for the tool bar of frame F to VALUE.
1831 VALUE not an integer, or < 0 means set the lines to zero. OLDVAL
1832 is the old number of tool bar lines. This function changes the
1833 height of all windows on frame F to match the new tool bar height.
1834 The frame's height doesn't change. */
1837 x_set_tool_bar_lines (f
, value
, oldval
)
1839 Lisp_Object value
, oldval
;
1841 int delta
, nlines
, root_height
;
1842 Lisp_Object root_window
;
1844 /* Treat tool bars like menu bars. */
1845 if (FRAME_MINIBUF_ONLY_P (f
))
1848 /* Use VALUE only if an integer >= 0. */
1849 if (INTEGERP (value
) && XINT (value
) >= 0)
1850 nlines
= XFASTINT (value
);
1854 /* Make sure we redisplay all windows in this frame. */
1855 ++windows_or_buffers_changed
;
1857 delta
= nlines
- FRAME_TOOL_BAR_LINES (f
);
1859 /* Don't resize the tool-bar to more than we have room for. */
1860 root_window
= FRAME_ROOT_WINDOW (f
);
1861 root_height
= WINDOW_TOTAL_LINES (XWINDOW (root_window
));
1862 if (root_height
- delta
< 1)
1864 delta
= root_height
- 1;
1865 nlines
= FRAME_TOOL_BAR_LINES (f
) + delta
;
1868 FRAME_TOOL_BAR_LINES (f
) = nlines
;
1869 change_window_heights (root_window
, delta
);
1872 /* We also have to make sure that the internal border at the top of
1873 the frame, below the menu bar or tool bar, is redrawn when the
1874 tool bar disappears. This is so because the internal border is
1875 below the tool bar if one is displayed, but is below the menu bar
1876 if there isn't a tool bar. The tool bar draws into the area
1877 below the menu bar. */
1878 if (FRAME_MAC_WINDOW (f
) && FRAME_TOOL_BAR_LINES (f
) == 0)
1882 clear_current_matrices (f
);
1883 updating_frame
= NULL
;
1886 /* If the tool bar gets smaller, the internal border below it
1887 has to be cleared. It was formerly part of the display
1888 of the larger tool bar, and updating windows won't clear it. */
1891 int height
= FRAME_INTERNAL_BORDER_WIDTH (f
);
1892 int width
= FRAME_PIXEL_WIDTH (f
);
1893 int y
= nlines
* FRAME_LINE_HEIGHT (f
);
1896 XClearArea (FRAME_MAC_DISPLAY (f
), FRAME_MAC_WINDOW (f
),
1897 0, y
, width
, height
, 0);
1900 if (WINDOWP (f
->tool_bar_window
))
1901 clear_glyph_matrix (XWINDOW (f
->tool_bar_window
)->current_matrix
);
1906 /* Change the name of frame F to NAME. If NAME is nil, set F's name to
1909 If EXPLICIT is non-zero, that indicates that lisp code is setting the
1910 name; if NAME is a string, set F's name to NAME and set
1911 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
1913 If EXPLICIT is zero, that indicates that Emacs redisplay code is
1914 suggesting a new name, which lisp code should override; if
1915 F->explicit_name is set, ignore the new name; otherwise, set it. */
1918 x_set_name (f
, name
, explicit)
1923 /* Make sure that requests from lisp code override requests from
1924 Emacs redisplay code. */
1927 /* If we're switching from explicit to implicit, we had better
1928 update the mode lines and thereby update the title. */
1929 if (f
->explicit_name
&& NILP (name
))
1930 update_mode_lines
= 1;
1932 f
->explicit_name
= ! NILP (name
);
1934 else if (f
->explicit_name
)
1937 /* If NAME is nil, set the name to the w32_id_name. */
1940 /* Check for no change needed in this very common case
1941 before we do any consing. */
1942 if (!strcmp (FRAME_MAC_DISPLAY_INFO (f
)->mac_id_name
,
1945 name
= build_string (FRAME_MAC_DISPLAY_INFO (f
)->mac_id_name
);
1948 CHECK_STRING (name
);
1950 /* Don't change the name if it's already NAME. */
1951 if (! NILP (Fstring_equal (name
, f
->name
)))
1956 /* For setting the frame title, the title parameter should override
1957 the name parameter. */
1958 if (! NILP (f
->title
))
1961 if (FRAME_MAC_WINDOW (f
))
1963 if (STRING_MULTIBYTE (name
))
1964 #if 0 /* MAC_TODO: encoding title string */
1965 name
= ENCODE_SYSTEM (name
);
1974 if (strlen (SDATA (name
)) < 255)
1976 strcpy (windowTitle
, SDATA (name
));
1977 c2pstr (windowTitle
);
1978 SetWTitle (FRAME_MAC_WINDOW (f
), windowTitle
);
1986 /* This function should be called when the user's lisp code has
1987 specified a name for the frame; the name will override any set by the
1990 x_explicitly_set_name (f
, arg
, oldval
)
1992 Lisp_Object arg
, oldval
;
1994 x_set_name (f
, arg
, 1);
1997 /* This function should be called by Emacs redisplay code to set the
1998 name; names set this way will never override names set by the user's
2001 x_implicitly_set_name (f
, arg
, oldval
)
2003 Lisp_Object arg
, oldval
;
2005 x_set_name (f
, arg
, 0);
2008 /* Change the title of frame F to NAME.
2009 If NAME is nil, use the frame name as the title.
2011 If EXPLICIT is non-zero, that indicates that lisp code is setting the
2012 name; if NAME is a string, set F's name to NAME and set
2013 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
2015 If EXPLICIT is zero, that indicates that Emacs redisplay code is
2016 suggesting a new name, which lisp code should override; if
2017 F->explicit_name is set, ignore the new name; otherwise, set it. */
2020 x_set_title (f
, name
, old_name
)
2022 Lisp_Object name
, old_name
;
2024 /* Don't change the title if it's already NAME. */
2025 if (EQ (name
, f
->title
))
2028 update_mode_lines
= 1;
2035 if (FRAME_MAC_WINDOW (f
))
2037 if (STRING_MULTIBYTE (name
))
2038 #if 0 /* MAC_TODO: encoding title string */
2039 name
= ENCODE_SYSTEM (name
);
2048 if (strlen (SDATA (name
)) < 255)
2050 strcpy (windowTitle
, SDATA (name
));
2051 c2pstr (windowTitle
);
2052 SetWTitle (FRAME_MAC_WINDOW (f
), windowTitle
);
2061 x_set_scroll_bar_default_width (f
)
2064 /* Imitate X without X Toolkit */
2066 int wid
= FRAME_COLUMN_WIDTH (f
);
2069 FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) = 16; /* Aqua scroll bars. */
2070 FRAME_CONFIG_SCROLL_BAR_COLS (f
) = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) +
2072 #else /* not MAC_OSX */
2073 /* Make the actual width at least 14 pixels and a multiple of a
2075 FRAME_CONFIG_SCROLL_BAR_COLS (f
) = (14 + wid
- 1) / wid
;
2077 /* Use all of that space (aside from required margins) for the
2079 FRAME_CONFIG_SCROLL_BAR_WIDTH (f
) = 0;
2080 #endif /* not MAC_OSX */
2084 /* Subroutines of creating a frame. */
2087 x_get_string_resource (rdb
, name
, class)
2091 /* MAC_TODO: implement resource strings */
2095 /* Return the value of parameter PARAM.
2097 First search ALIST, then Vdefault_frame_alist, then the X defaults
2098 database, using ATTRIBUTE as the attribute name and CLASS as its class.
2100 Convert the resource to the type specified by desired_type.
2102 If no default is specified, return Qunbound. If you call
2103 mac_get_arg, make sure you deal with Qunbound in a reasonable way,
2104 and don't let it get stored in any Lisp-visible variables! */
2107 mac_get_arg (alist
, param
, attribute
, class, type
)
2108 Lisp_Object alist
, param
;
2111 enum resource_types type
;
2113 return x_get_arg (check_x_display_info (Qnil
),
2114 alist
, param
, attribute
, class, type
);
2118 /* XParseGeometry copied from w32xfns.c */
2121 * XParseGeometry parses strings of the form
2122 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
2123 * width, height, xoffset, and yoffset are unsigned integers.
2124 * Example: "=80x24+300-49"
2125 * The equal sign is optional.
2126 * It returns a bitmask that indicates which of the four values
2127 * were actually found in the string. For each value found,
2128 * the corresponding argument is updated; for each value
2129 * not found, the corresponding argument is left unchanged.
2133 read_integer (string
, NextString
)
2134 register char *string
;
2137 register int Result
= 0;
2142 else if (*string
== '-')
2147 for (; (*string
>= '0') && (*string
<= '9'); string
++)
2149 Result
= (Result
* 10) + (*string
- '0');
2151 *NextString
= string
;
2159 XParseGeometry (string
, x
, y
, width
, height
)
2162 unsigned int *width
, *height
; /* RETURN */
2165 register char *strind
;
2166 unsigned int tempWidth
, tempHeight
;
2168 char *nextCharacter
;
2170 if ((string
== NULL
) || (*string
== '\0')) return (mask
);
2172 string
++; /* ignore possible '=' at beg of geometry spec */
2174 strind
= (char *)string
;
2175 if (*strind
!= '+' && *strind
!= '-' && *strind
!= 'x')
2177 tempWidth
= read_integer (strind
, &nextCharacter
);
2178 if (strind
== nextCharacter
)
2180 strind
= nextCharacter
;
2184 if (*strind
== 'x' || *strind
== 'X')
2187 tempHeight
= read_integer (strind
, &nextCharacter
);
2188 if (strind
== nextCharacter
)
2190 strind
= nextCharacter
;
2191 mask
|= HeightValue
;
2194 if ((*strind
== '+') || (*strind
== '-'))
2199 tempX
= -read_integer (strind
, &nextCharacter
);
2200 if (strind
== nextCharacter
)
2202 strind
= nextCharacter
;
2209 tempX
= read_integer (strind
, &nextCharacter
);
2210 if (strind
== nextCharacter
)
2212 strind
= nextCharacter
;
2215 if ((*strind
== '+') || (*strind
== '-'))
2220 tempY
= -read_integer (strind
, &nextCharacter
);
2221 if (strind
== nextCharacter
)
2223 strind
= nextCharacter
;
2230 tempY
= read_integer (strind
, &nextCharacter
);
2231 if (strind
== nextCharacter
)
2233 strind
= nextCharacter
;
2239 /* If strind isn't at the end of the string the it's an invalid
2240 geometry specification. */
2242 if (*strind
!= '\0') return (0);
2248 if (mask
& WidthValue
)
2250 if (mask
& HeightValue
)
2251 *height
= tempHeight
;
2256 #if 0 /* MAC_TODO */
2257 /* Create and set up the Mac window for frame F. */
2260 mac_window (f
, window_prompting
, minibuffer_only
)
2262 long window_prompting
;
2263 int minibuffer_only
;
2269 /* Use the resource name as the top-level window name
2270 for looking up resources. Make a non-Lisp copy
2271 for the window manager, so GC relocation won't bother it.
2273 Elsewhere we specify the window name for the window manager. */
2276 char *str
= (char *) SDATA (Vx_resource_name
);
2277 f
->namebuf
= (char *) xmalloc (strlen (str
) + 1);
2278 strcpy (f
->namebuf
, str
);
2281 SetRect (&r
, f
->left_pos
, f
->top_pos
,
2282 f
->left_pos
+ FRAME_PIXEL_WIDTH (f
),
2283 f
->top_pos
+ FRAME_PIXEL_HEIGHT (f
));
2284 FRAME_MAC_WINDOW (f
)
2285 = NewCWindow (NULL
, &r
, "\p", 1, zoomDocProc
, (WindowPtr
) -1, 1, (long) f
->output_data
.mac
);
2287 validate_x_resource_name ();
2289 /* x_set_name normally ignores requests to set the name if the
2290 requested name is the same as the current name. This is the one
2291 place where that assumption isn't correct; f->name is set, but
2292 the server hasn't been told. */
2295 int explicit = f
->explicit_name
;
2297 f
->explicit_name
= 0;
2300 x_set_name (f
, name
, explicit);
2303 ShowWindow (FRAME_MAC_WINDOW (f
));
2307 if (!minibuffer_only
&& FRAME_EXTERNAL_MENU_BAR (f
))
2308 initialize_frame_menubar (f
);
2310 if (FRAME_MAC_WINDOW (f
) == 0)
2311 error ("Unable to create window");
2313 #endif /* MAC_TODO */
2315 /* Handle the icon stuff for this window. Perhaps later we might
2316 want an x_set_icon_position which can be called interactively as
2324 Lisp_Object icon_x
, icon_y
;
2326 /* Set the position of the icon. Note that Windows 95 groups all
2327 icons in the tray. */
2328 icon_x
= mac_get_arg (parms
, Qicon_left
, 0, 0, RES_TYPE_NUMBER
);
2329 icon_y
= mac_get_arg (parms
, Qicon_top
, 0, 0, RES_TYPE_NUMBER
);
2330 if (!EQ (icon_x
, Qunbound
) && !EQ (icon_y
, Qunbound
))
2332 CHECK_NUMBER (icon_x
);
2333 CHECK_NUMBER (icon_y
);
2335 else if (!EQ (icon_x
, Qunbound
) || !EQ (icon_y
, Qunbound
))
2336 error ("Both left and top icon corners of icon must be specified");
2340 if (! EQ (icon_x
, Qunbound
))
2341 x_wm_set_icon_position (f
, XINT (icon_x
), XINT (icon_y
));
2344 /* Start up iconic or window? */
2345 x_wm_set_window_state
2346 (f
, (EQ (w32_get_arg (parms
, Qvisibility
, 0, 0, RES_TYPE_SYMBOL
), Qicon
)
2350 x_text_icon (f
, (char *) SDATA ((!NILP (f
->icon_name
)
2363 XGCValues gc_values
;
2367 /* Create the GCs of this frame.
2368 Note that many default values are used. */
2371 gc_values
.font
= FRAME_FONT (f
);
2372 gc_values
.foreground
= FRAME_FOREGROUND_PIXEL (f
);
2373 gc_values
.background
= FRAME_BACKGROUND_PIXEL (f
);
2374 f
->output_data
.mac
->normal_gc
= XCreateGC (FRAME_MAC_DISPLAY (f
),
2375 FRAME_MAC_WINDOW (f
),
2376 GCFont
| GCForeground
| GCBackground
,
2379 /* Reverse video style. */
2380 gc_values
.foreground
= FRAME_BACKGROUND_PIXEL (f
);
2381 gc_values
.background
= FRAME_FOREGROUND_PIXEL (f
);
2382 f
->output_data
.mac
->reverse_gc
= XCreateGC (FRAME_MAC_DISPLAY (f
),
2383 FRAME_MAC_WINDOW (f
),
2384 GCFont
| GCForeground
| GCBackground
,
2387 /* Cursor has cursor-color background, background-color foreground. */
2388 gc_values
.foreground
= FRAME_BACKGROUND_PIXEL (f
);
2389 gc_values
.background
= f
->output_data
.mac
->cursor_pixel
;
2390 f
->output_data
.mac
->cursor_gc
= XCreateGC (FRAME_MAC_DISPLAY (f
),
2391 FRAME_MAC_WINDOW (f
),
2392 GCFont
| GCForeground
| GCBackground
,
2396 f
->output_data
.mac
->white_relief
.gc
= 0;
2397 f
->output_data
.mac
->black_relief
.gc
= 0;
2400 /* Create the gray border tile used when the pointer is not in
2401 the frame. Since this depends on the frame's pixel values,
2402 this must be done on a per-frame basis. */
2403 f
->output_data
.x
->border_tile
2404 = (XCreatePixmapFromBitmapData
2405 (FRAME_X_DISPLAY (f
), FRAME_X_DISPLAY_INFO (f
)->root_window
,
2406 gray_bits
, gray_width
, gray_height
,
2407 f
->output_data
.x
->foreground_pixel
,
2408 f
->output_data
.x
->background_pixel
,
2409 DefaultDepth (FRAME_X_DISPLAY (f
), FRAME_X_SCREEN_NUMBER (f
))));
2416 /* Free what was was allocated in x_make_gc. */
2422 Display
*dpy
= FRAME_MAC_DISPLAY (f
);
2426 if (f
->output_data
.mac
->normal_gc
)
2428 XFreeGC (dpy
, f
->output_data
.mac
->normal_gc
);
2429 f
->output_data
.mac
->normal_gc
= 0;
2432 if (f
->output_data
.mac
->reverse_gc
)
2434 XFreeGC (dpy
, f
->output_data
.mac
->reverse_gc
);
2435 f
->output_data
.mac
->reverse_gc
= 0;
2438 if (f
->output_data
.mac
->cursor_gc
)
2440 XFreeGC (dpy
, f
->output_data
.mac
->cursor_gc
);
2441 f
->output_data
.mac
->cursor_gc
= 0;
2445 if (f
->output_data
.mac
->border_tile
)
2447 XFreePixmap (dpy
, f
->output_data
.mac
->border_tile
);
2448 f
->output_data
.mac
->border_tile
= 0;
2452 if (f
->output_data
.mac
->white_relief
.gc
)
2454 XFreeGC (dpy
, f
->output_data
.mac
->white_relief
.gc
);
2455 f
->output_data
.mac
->white_relief
.gc
= 0;
2458 if (f
->output_data
.mac
->black_relief
.gc
)
2460 XFreeGC (dpy
, f
->output_data
.mac
->black_relief
.gc
);
2461 f
->output_data
.mac
->black_relief
.gc
= 0;
2468 /* Handler for signals raised during x_create_frame and
2469 x_create_top_frame. FRAME is the frame which is partially
2473 unwind_create_frame (frame
)
2476 struct frame
*f
= XFRAME (frame
);
2478 /* If frame is ``official'', nothing to do. */
2479 if (!CONSP (Vframe_list
) || !EQ (XCAR (Vframe_list
), frame
))
2482 struct x_display_info
*dpyinfo
= FRAME_X_DISPLAY_INFO (f
);
2485 x_free_frame_resources (f
);
2487 /* Check that reference counts are indeed correct. */
2488 xassert (dpyinfo
->reference_count
== dpyinfo_refcount
);
2489 xassert (dpyinfo
->image_cache
->refcount
== image_cache_refcount
);
2497 DEFUN ("x-create-frame", Fx_create_frame
, Sx_create_frame
,
2499 doc
: /* Make a new window, which is called a \"frame\" in Emacs terms.
2500 Returns an Emacs frame object.
2501 ALIST is an alist of frame parameters.
2502 If the parameters specify that the frame should not have a minibuffer,
2503 and do not specify a specific minibuffer window to use,
2504 then `default-minibuffer-frame' must be a frame whose minibuffer can
2505 be shared by the new frame.
2507 This function is an internal primitive--use `make-frame' instead. */)
2512 Lisp_Object frame
, tem
;
2514 int minibuffer_only
= 0;
2515 long window_prompting
= 0;
2517 int count
= SPECPDL_INDEX ();
2518 struct gcpro gcpro1
, gcpro2
, gcpro3
, gcpro4
;
2519 Lisp_Object display
;
2520 struct mac_display_info
*dpyinfo
= NULL
;
2523 char x_frame_name
[10];
2524 static int x_frame_count
= 2; /* begins at 2 because terminal frame is F1 */
2528 /* Use this general default value to start with
2529 until we know if this frame has a specified name. */
2530 Vx_resource_name
= Vinvocation_name
;
2532 display
= mac_get_arg (parms
, Qdisplay
, 0, 0, RES_TYPE_STRING
);
2533 if (EQ (display
, Qunbound
))
2535 dpyinfo
= check_x_display_info (display
);
2537 kb
= dpyinfo
->kboard
;
2539 kb
= &the_only_kboard
;
2542 name
= mac_get_arg (parms
, Qname
, "name", "Name", RES_TYPE_STRING
);
2544 && ! EQ (name
, Qunbound
)
2546 error ("Invalid frame name--not a string or nil");
2549 Vx_resource_name
= name
;
2551 /* See if parent window is specified. */
2552 parent
= mac_get_arg (parms
, Qparent_id
, NULL
, NULL
, RES_TYPE_NUMBER
);
2553 if (EQ (parent
, Qunbound
))
2555 if (! NILP (parent
))
2556 CHECK_NUMBER (parent
);
2558 /* make_frame_without_minibuffer can run Lisp code and garbage collect. */
2559 /* No need to protect DISPLAY because that's not used after passing
2560 it to make_frame_without_minibuffer. */
2562 GCPRO4 (parms
, parent
, name
, frame
);
2563 tem
= mac_get_arg (parms
, Qminibuffer
, "minibuffer", "Minibuffer",
2565 if (EQ (tem
, Qnone
) || NILP (tem
))
2566 f
= make_frame_without_minibuffer (Qnil
, kb
, display
);
2567 else if (EQ (tem
, Qonly
))
2569 f
= make_minibuffer_frame ();
2570 minibuffer_only
= 1;
2572 else if (WINDOWP (tem
))
2573 f
= make_frame_without_minibuffer (tem
, kb
, display
);
2577 if (EQ (name
, Qunbound
) || NILP (name
))
2579 sprintf (x_frame_name
, "F%d", x_frame_count
++);
2580 f
->name
= build_string (x_frame_name
);
2581 f
->explicit_name
= 0;
2586 f
->explicit_name
= 1;
2589 XSETFRAME (frame
, f
);
2591 /* Note that X Windows does support scroll bars. */
2592 FRAME_CAN_HAVE_SCROLL_BARS (f
) = 1;
2594 f
->output_method
= output_mac
;
2595 f
->output_data
.mac
= (struct mac_output
*) xmalloc (sizeof (struct mac_output
));
2596 bzero (f
->output_data
.mac
, sizeof (struct mac_output
));
2597 FRAME_FONTSET (f
) = -1;
2598 f
->output_data
.mac
->scroll_bar_foreground_pixel
= -1;
2599 f
->output_data
.mac
->scroll_bar_background_pixel
= -1;
2600 record_unwind_protect (unwind_create_frame
, frame
);
2603 = mac_get_arg (parms
, Qicon_name
, "iconName", "Title", RES_TYPE_STRING
);
2604 if (! STRINGP (f
->icon_name
))
2605 f
->icon_name
= Qnil
;
2607 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
2609 FRAME_KBOARD (f
) = kb
;
2612 /* Specify the parent under which to make this window. */
2616 f
->output_data
.mac
->parent_desc
= (Window
) parent
;
2617 f
->output_data
.mac
->explicit_parent
= 1;
2621 f
->output_data
.mac
->parent_desc
= FRAME_MAC_DISPLAY_INFO (f
)->root_window
;
2622 f
->output_data
.mac
->explicit_parent
= 0;
2625 /* Set the name; the functions to which we pass f expect the name to
2627 if (EQ (name
, Qunbound
) || NILP (name
))
2629 f
->name
= build_string (dpyinfo
->mac_id_name
);
2630 f
->explicit_name
= 0;
2635 f
->explicit_name
= 1;
2636 /* use the frame's title when getting resources for this frame. */
2637 specbind (Qx_resource_name
, name
);
2640 /* Extract the window parameters from the supplied values
2641 that are needed to determine window geometry. */
2645 font
= mac_get_arg (parms
, Qfont
, "font", "Font", RES_TYPE_STRING
);
2648 /* First, try whatever font the caller has specified. */
2651 tem
= Fquery_fontset (font
, Qnil
);
2653 font
= x_new_fontset (f
, SDATA (tem
));
2655 font
= x_new_font (f
, SDATA (font
));
2658 /* Try out a font which we hope has bold and italic variations. */
2659 if (! STRINGP (font
))
2660 font
= x_new_font (f
, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1");
2661 /* If those didn't work, look for something which will at least work. */
2662 if (! STRINGP (font
))
2663 font
= x_new_font (f
, "-*-monaco-*-12-*-mac-roman");
2664 if (! STRINGP (font
))
2665 font
= x_new_font (f
, "-*-courier-*-10-*-mac-roman");
2666 if (! STRINGP (font
))
2667 error ("Cannot find any usable font");
2670 x_default_parameter (f
, parms
, Qfont
, font
,
2671 "font", "Font", RES_TYPE_STRING
);
2674 x_default_parameter (f
, parms
, Qborder_width
, make_number (0),
2675 "borderwidth", "BorderWidth", RES_TYPE_NUMBER
);
2676 /* This defaults to 2 in order to match xterm. We recognize either
2677 internalBorderWidth or internalBorder (which is what xterm calls
2679 if (NILP (Fassq (Qinternal_border_width
, parms
)))
2683 value
= mac_get_arg (parms
, Qinternal_border_width
,
2684 "internalBorder", "InternalBorder", RES_TYPE_NUMBER
);
2685 if (! EQ (value
, Qunbound
))
2686 parms
= Fcons (Fcons (Qinternal_border_width
, value
),
2689 /* Default internalBorderWidth to 0 on Windows to match other programs. */
2690 x_default_parameter (f
, parms
, Qinternal_border_width
, make_number (0),
2691 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER
);
2692 x_default_parameter (f
, parms
, Qvertical_scroll_bars
, Qright
,
2693 "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL
);
2695 /* Also do the stuff which must be set before the window exists. */
2696 x_default_parameter (f
, parms
, Qforeground_color
, build_string ("black"),
2697 "foreground", "Foreground", RES_TYPE_STRING
);
2698 x_default_parameter (f
, parms
, Qbackground_color
, build_string ("white"),
2699 "background", "Background", RES_TYPE_STRING
);
2700 x_default_parameter (f
, parms
, Qmouse_color
, build_string ("black"),
2701 "pointerColor", "Foreground", RES_TYPE_STRING
);
2702 x_default_parameter (f
, parms
, Qcursor_color
, build_string ("black"),
2703 "cursorColor", "Foreground", RES_TYPE_STRING
);
2704 x_default_parameter (f
, parms
, Qborder_color
, build_string ("black"),
2705 "borderColor", "BorderColor", RES_TYPE_STRING
);
2706 x_default_parameter (f
, parms
, Qscreen_gamma
, Qnil
,
2707 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT
);
2708 x_default_parameter (f
, parms
, Qline_spacing
, Qnil
,
2709 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER
);
2710 x_default_parameter (f
, parms
, Qleft_fringe
, Qnil
,
2711 "leftFringe", "LeftFringe", RES_TYPE_NUMBER
);
2712 x_default_parameter (f
, parms
, Qright_fringe
, Qnil
,
2713 "rightFringe", "RightFringe", RES_TYPE_NUMBER
);
2716 /* Init faces before x_default_parameter is called for scroll-bar
2717 parameters because that function calls x_set_scroll_bar_width,
2718 which calls change_frame_size, which calls Fset_window_buffer,
2719 which runs hooks, which call Fvertical_motion. At the end, we
2720 end up in init_iterator with a null face cache, which should not
2722 init_frame_faces (f
);
2724 x_default_parameter (f
, parms
, Qmenu_bar_lines
, make_number (1),
2725 "menuBar", "MenuBar", RES_TYPE_NUMBER
);
2726 x_default_parameter (f
, parms
, Qtool_bar_lines
, make_number (0),
2727 "toolBar", "ToolBar", RES_TYPE_NUMBER
);
2728 x_default_parameter (f
, parms
, Qbuffer_predicate
, Qnil
,
2729 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL
);
2730 x_default_parameter (f
, parms
, Qtitle
, Qnil
,
2731 "title", "Title", RES_TYPE_STRING
);
2733 f
->output_data
.mac
->parent_desc
= FRAME_MAC_DISPLAY_INFO (f
)->root_window
;
2735 /* MAC_TODO: specify 1 below when toolbars are implemented. */
2736 window_prompting
= x_figure_window_size (f
, parms
, 0);
2738 tem
= mac_get_arg (parms
, Qunsplittable
, 0, 0, RES_TYPE_BOOLEAN
);
2739 f
->no_split
= minibuffer_only
|| EQ (tem
, Qt
);
2741 /* Create the window. Add the tool-bar height to the initial frame
2742 height so that the user gets a text display area of the size he
2743 specified with -g or via the registry. Later changes of the
2744 tool-bar height don't change the frame size. This is done so that
2745 users can create tall Emacs frames without having to guess how
2746 tall the tool-bar will get. */
2747 FRAME_LINES (f
) += FRAME_TOOL_BAR_LINES (f
);
2749 /* mac_window (f, window_prompting, minibuffer_only); */
2756 /* Now consider the frame official. */
2757 FRAME_MAC_DISPLAY_INFO (f
)->reference_count
++;
2758 Vframe_list
= Fcons (frame
, Vframe_list
);
2760 /* We need to do this after creating the window, so that the
2761 icon-creation functions can say whose icon they're describing. */
2762 x_default_parameter (f
, parms
, Qicon_type
, Qnil
,
2763 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL
);
2765 x_default_parameter (f
, parms
, Qauto_raise
, Qnil
,
2766 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN
);
2767 x_default_parameter (f
, parms
, Qauto_lower
, Qnil
,
2768 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN
);
2769 x_default_parameter (f
, parms
, Qcursor_type
, Qbox
,
2770 "cursorType", "CursorType", RES_TYPE_SYMBOL
);
2771 x_default_parameter (f
, parms
, Qscroll_bar_width
, Qnil
,
2772 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER
);
2774 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
2775 Change will not be effected unless different from the current
2777 width
= FRAME_COLS (f
);
2778 height
= FRAME_LINES (f
);
2780 FRAME_LINES (f
) = 0;
2781 SET_FRAME_COLS (f
, 0);
2782 change_frame_size (f
, height
, width
, 1, 0, 0);
2784 /* Set up faces after all frame parameters are known. */
2785 call1 (Qface_set_after_frame_default
, frame
);
2787 #if 0 /* MAC_TODO: when we have window manager hints */
2788 /* Tell the server what size and position, etc, we want, and how
2789 badly we want them. This should be done after we have the menu
2790 bar so that its size can be taken into account. */
2792 x_wm_set_size_hint (f
, window_prompting
, 0);
2796 /* Make the window appear on the frame and enable display, unless
2797 the caller says not to. However, with explicit parent, Emacs
2798 cannot control visibility, so don't try. */
2799 if (! f
->output_data
.mac
->explicit_parent
)
2801 Lisp_Object visibility
;
2803 visibility
= mac_get_arg (parms
, Qvisibility
, 0, 0, RES_TYPE_SYMBOL
);
2804 if (EQ (visibility
, Qunbound
))
2807 #if 0 /* MAC_TODO: really no iconify on Mac */
2808 if (EQ (visibility
, Qicon
))
2809 x_iconify_frame (f
);
2812 if (! NILP (visibility
))
2813 x_make_frame_visible (f
);
2815 /* Must have been Qnil. */
2820 /* Make sure windows on this frame appear in calls to next-window
2821 and similar functions. */
2822 Vwindow_list
= Qnil
;
2824 return unbind_to (count
, frame
);
2827 /* FRAME is used only to get a handle on the X display. We don't pass the
2828 display info directly because we're called from frame.c, which doesn't
2829 know about that structure. */
2831 x_get_focus_frame (frame
)
2832 struct frame
*frame
;
2834 struct mac_display_info
*dpyinfo
= FRAME_MAC_DISPLAY_INFO (frame
);
2836 if (! dpyinfo
->x_focus_frame
)
2839 XSETFRAME (xfocus
, dpyinfo
->x_focus_frame
);
2843 DEFUN ("xw-color-defined-p", Fxw_color_defined_p
, Sxw_color_defined_p
, 1, 2, 0,
2844 doc
: /* Internal function called by `color-defined-p', which see. */)
2846 Lisp_Object color
, frame
;
2849 FRAME_PTR f
= check_x_frame (frame
);
2851 CHECK_STRING (color
);
2853 if (mac_defined_color (f
, SDATA (color
), &foo
, 0))
2859 DEFUN ("xw-color-values", Fxw_color_values
, Sxw_color_values
, 1, 2, 0,
2860 doc
: /* Internal function called by `color-values', which see. */)
2862 Lisp_Object color
, frame
;
2865 FRAME_PTR f
= check_x_frame (frame
);
2867 CHECK_STRING (color
);
2869 if (mac_defined_color (f
, SDATA (color
), &foo
, 0))
2873 rgb
[0] = make_number (foo
.red
);
2874 rgb
[1] = make_number (foo
.green
);
2875 rgb
[2] = make_number (foo
.blue
);
2876 return Flist (3, rgb
);
2882 DEFUN ("xw-display-color-p", Fxw_display_color_p
, Sxw_display_color_p
, 0, 1, 0,
2883 doc
: /* Internal function called by `display-color-p', which see. */)
2885 Lisp_Object display
;
2887 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2889 if (!dpyinfo
->color_p
)
2895 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p
, Sx_display_grayscale_p
,
2897 doc
: /* Return t if the X display supports shades of gray.
2898 Note that color displays do support shades of gray.
2899 The optional argument DISPLAY specifies which display to ask about.
2900 DISPLAY should be either a frame or a display name (a string).
2901 If omitted or nil, that stands for the selected frame's display. */)
2903 Lisp_Object display
;
2905 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2907 if (dpyinfo
->n_planes
<= 1)
2913 DEFUN ("x-display-pixel-width", Fx_display_pixel_width
, Sx_display_pixel_width
,
2915 doc
: /* Returns the width in pixels of the X display DISPLAY.
2916 The optional argument DISPLAY specifies which display to ask about.
2917 DISPLAY should be either a frame or a display name (a string).
2918 If omitted or nil, that stands for the selected frame's display. */)
2920 Lisp_Object display
;
2922 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2924 return make_number (dpyinfo
->width
);
2927 DEFUN ("x-display-pixel-height", Fx_display_pixel_height
,
2928 Sx_display_pixel_height
, 0, 1, 0,
2929 doc
: /* Returns the height in pixels of the X display DISPLAY.
2930 The optional argument DISPLAY specifies which display to ask about.
2931 DISPLAY should be either a frame or a display name (a string).
2932 If omitted or nil, that stands for the selected frame's display. */)
2934 Lisp_Object display
;
2936 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2938 return make_number (dpyinfo
->height
);
2941 DEFUN ("x-display-planes", Fx_display_planes
, Sx_display_planes
,
2943 doc
: /* Returns the number of bitplanes of the display DISPLAY.
2944 The optional argument DISPLAY specifies which display to ask about.
2945 DISPLAY should be either a frame or a display name (a string).
2946 If omitted or nil, that stands for the selected frame's display. */)
2948 Lisp_Object display
;
2950 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2952 return make_number (dpyinfo
->n_planes
);
2955 DEFUN ("x-display-color-cells", Fx_display_color_cells
, Sx_display_color_cells
,
2957 doc
: /* Returns the number of color cells of the display DISPLAY.
2958 The optional argument DISPLAY specifies which display to ask about.
2959 DISPLAY should be either a frame or a display name (a string).
2960 If omitted or nil, that stands for the selected frame's display. */)
2962 Lisp_Object display
;
2964 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2966 /* MAC_TODO: check whether this is right */
2967 return make_number (dpyinfo
->n_planes
>= 8 ? 256 : 1 << dpyinfo
->n_planes
- 1);
2970 DEFUN ("x-server-max-request-size", Fx_server_max_request_size
,
2971 Sx_server_max_request_size
,
2973 doc
: /* Returns the maximum request size of the server of display DISPLAY.
2974 The optional argument DISPLAY specifies which display to ask about.
2975 DISPLAY should be either a frame or a display name (a string).
2976 If omitted or nil, that stands for the selected frame's display. */)
2978 Lisp_Object display
;
2980 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
2982 return make_number (1);
2985 DEFUN ("x-server-vendor", Fx_server_vendor
, Sx_server_vendor
, 0, 1, 0,
2986 doc
: /* Returns the vendor ID string of the Mac OS system (Apple).
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 return build_string ("Apple Computers");
2996 DEFUN ("x-server-version", Fx_server_version
, Sx_server_version
, 0, 1, 0,
2997 doc
: /* Returns the version numbers of the server of display DISPLAY.
2998 The value is a list of three integers: the major and minor
2999 version numbers, and the vendor-specific release
3000 number. See also the function `x-server-vendor'.
3002 The optional argument DISPLAY specifies which display to ask about.
3003 DISPLAY should be either a frame or a display name (a string).
3004 If omitted or nil, that stands for the selected frame's display. */)
3006 Lisp_Object display
;
3008 int mac_major_version
, mac_minor_version
;
3011 if (Gestalt (gestaltSystemVersion
, &response
) != noErr
)
3012 error ("Cannot get Mac OS version");
3014 mac_major_version
= (response
>> 8) & 0xf;
3015 mac_minor_version
= (response
>> 4) & 0xf;
3017 return Fcons (make_number (mac_major_version
),
3018 Fcons (make_number (mac_minor_version
), Qnil
));
3021 DEFUN ("x-display-screens", Fx_display_screens
, Sx_display_screens
, 0, 1, 0,
3022 doc
: /* Return the number of screens on the server of display DISPLAY.
3023 The optional argument DISPLAY specifies which display to ask about.
3024 DISPLAY should be either a frame or a display name (a string).
3025 If omitted or nil, that stands for the selected frame's display. */)
3027 Lisp_Object display
;
3029 return make_number (1);
3032 DEFUN ("x-display-mm-height", Fx_display_mm_height
, Sx_display_mm_height
, 0, 1, 0,
3033 doc
: /* Return the height in millimeters of the X display DISPLAY.
3034 The optional argument DISPLAY specifies which display to ask about.
3035 DISPLAY should be either a frame or a display name (a string).
3036 If omitted or nil, that stands for the selected frame's display. */)
3038 Lisp_Object display
;
3040 /* MAC_TODO: this is an approximation, and only of the main display */
3042 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
3047 return make_number ((int) (v
/ 72.0 * 25.4));
3050 DEFUN ("x-display-mm-width", Fx_display_mm_width
, Sx_display_mm_width
, 0, 1, 0,
3051 doc
: /* Return the width in millimeters of the X display DISPLAY.
3052 The optional argument DISPLAY specifies which display to ask about.
3053 DISPLAY should be either a frame or a display name (a string).
3054 If omitted or nil, that stands for the selected frame's display. */)
3056 Lisp_Object display
;
3058 /* MAC_TODO: this is an approximation, and only of the main display */
3060 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
3065 return make_number ((int) (h
/ 72.0 * 25.4));
3068 DEFUN ("x-display-backing-store", Fx_display_backing_store
,
3069 Sx_display_backing_store
, 0, 1, 0,
3070 doc
: /* Returns an indication of whether display DISPLAY does backing store.
3071 The value may be `always', `when-mapped', or `not-useful'.
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 return intern ("not-useful");
3081 DEFUN ("x-display-visual-class", Fx_display_visual_class
,
3082 Sx_display_visual_class
, 0, 1, 0,
3083 doc
: /* Returns the visual class of the display DISPLAY.
3084 The value is one of the symbols `static-gray', `gray-scale',
3085 `static-color', `pseudo-color', `true-color', or `direct-color'.
3087 The optional argument DISPLAY specifies which display to ask about.
3088 DISPLAY should be either a frame or a display name (a string).
3089 If omitted or nil, that stands for the selected frame's display. */)
3091 Lisp_Object display
;
3093 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
3096 switch (dpyinfo
->visual
->class)
3098 case StaticGray
: return (intern ("static-gray"));
3099 case GrayScale
: return (intern ("gray-scale"));
3100 case StaticColor
: return (intern ("static-color"));
3101 case PseudoColor
: return (intern ("pseudo-color"));
3102 case TrueColor
: return (intern ("true-color"));
3103 case DirectColor
: return (intern ("direct-color"));
3105 error ("Display has an unknown visual class");
3109 return (intern ("true-color"));
3112 DEFUN ("x-display-save-under", Fx_display_save_under
,
3113 Sx_display_save_under
, 0, 1, 0,
3114 doc
: /* Returns t if the display DISPLAY supports the save-under feature.
3115 The optional argument DISPLAY specifies which display to ask about.
3116 DISPLAY should be either a frame or a display name (a string).
3117 If omitted or nil, that stands for the selected frame's display. */)
3119 Lisp_Object display
;
3126 register struct frame
*f
;
3128 return FRAME_PIXEL_WIDTH (f
);
3133 register struct frame
*f
;
3135 return FRAME_PIXEL_HEIGHT (f
);
3140 register struct frame
*f
;
3142 return FRAME_COLUMN_WIDTH (f
);
3147 register struct frame
*f
;
3149 return FRAME_LINE_HEIGHT (f
);
3154 register struct frame
*f
;
3156 return FRAME_MAC_DISPLAY_INFO (f
)->n_planes
;
3159 /* Return the display structure for the display named NAME.
3160 Open a new connection if necessary. */
3162 struct mac_display_info
*
3163 x_display_info_for_name (name
)
3167 struct mac_display_info
*dpyinfo
;
3169 CHECK_STRING (name
);
3171 for (dpyinfo
= &one_mac_display_info
, names
= x_display_name_list
;
3173 dpyinfo
= dpyinfo
->next
, names
= XCDR (names
))
3176 tem
= Fstring_equal (XCAR (XCAR (names
)), name
);
3181 /* Use this general default value to start with. */
3182 Vx_resource_name
= Vinvocation_name
;
3184 validate_x_resource_name ();
3186 dpyinfo
= mac_term_init (name
, (unsigned char *) 0,
3187 (char *) SDATA (Vx_resource_name
));
3190 error ("Cannot connect to server %s", SDATA (name
));
3193 XSETFASTINT (Vwindow_system_version
, 3);
3198 #if 0 /* MAC_TODO: implement network support */
3199 DEFUN ("x-open-connection", Fx_open_connection
, Sx_open_connection
,
3201 doc
: /* Open a connection to a server.
3202 DISPLAY is the name of the display to connect to.
3203 Optional second arg XRM-STRING is a string of resources in xrdb format.
3204 If the optional third arg MUST-SUCCEED is non-nil,
3205 terminate Emacs if we can't open the connection. */)
3206 (display
, xrm_string
, must_succeed
)
3207 Lisp_Object display
, xrm_string
, must_succeed
;
3209 unsigned char *xrm_option
;
3210 struct mac_display_info
*dpyinfo
;
3212 CHECK_STRING (display
);
3213 if (! NILP (xrm_string
))
3214 CHECK_STRING (xrm_string
);
3216 if (! EQ (Vwindow_system
, intern ("mac")))
3217 error ("Not using Mac OS");
3219 if (! NILP (xrm_string
))
3220 xrm_option
= (unsigned char *) SDATA (xrm_string
);
3222 xrm_option
= (unsigned char *) 0;
3224 validate_x_resource_name ();
3226 /* This is what opens the connection and sets x_current_display.
3227 This also initializes many symbols, such as those used for input. */
3228 dpyinfo
= mac_term_init (display
, xrm_option
,
3229 (char *) SDATA (Vx_resource_name
));
3233 if (!NILP (must_succeed
))
3234 fatal ("Cannot connect to server %s.\n",
3237 error ("Cannot connect to server %s", SDATA (display
));
3242 XSETFASTINT (Vwindow_system_version
, 3);
3246 DEFUN ("x-close-connection", Fx_close_connection
,
3247 Sx_close_connection
, 1, 1, 0,
3248 doc
: /* Close the connection to DISPLAY's server.
3249 For DISPLAY, specify either a frame or a display name (a string).
3250 If DISPLAY is nil, that stands for the selected frame's display. */)
3252 Lisp_Object display
;
3254 struct mac_display_info
*dpyinfo
= check_x_display_info (display
);
3257 if (dpyinfo
->reference_count
> 0)
3258 error ("Display still has frames on it");
3261 /* Free the fonts in the font table. */
3262 for (i
= 0; i
< dpyinfo
->n_fonts
; i
++)
3263 if (dpyinfo
->font_table
[i
].name
)
3265 if (dpyinfo
->font_table
[i
].name
!= dpyinfo
->font_table
[i
].full_name
)
3266 xfree (dpyinfo
->font_table
[i
].full_name
);
3267 xfree (dpyinfo
->font_table
[i
].name
);
3268 x_unload_font (dpyinfo
, dpyinfo
->font_table
[i
].font
);
3270 x_destroy_all_bitmaps (dpyinfo
);
3272 x_delete_display (dpyinfo
);
3279 DEFUN ("x-display-list", Fx_display_list
, Sx_display_list
, 0, 0, 0,
3280 doc
: /* Return the list of display names that Emacs has connections to. */)
3283 Lisp_Object tail
, result
;
3286 for (tail
= x_display_name_list
; ! NILP (tail
); tail
= XCDR (tail
))
3287 result
= Fcons (XCAR (XCAR (tail
)), result
);
3292 DEFUN ("x-synchronize", Fx_synchronize
, Sx_synchronize
, 1, 2, 0,
3293 doc
: /* If ON is non-nil, report errors as soon as the erring request is made.
3294 If ON is nil, allow buffering of requests.
3295 This is a noop on Mac OS systems.
3296 The optional second argument DISPLAY specifies which display to act on.
3297 DISPLAY should be either a frame or a display name (a string).
3298 If DISPLAY is omitted or nil, that stands for the selected frame's display. */)
3300 Lisp_Object display
, on
;
3306 /***********************************************************************
3308 ***********************************************************************/
3310 DEFUN ("x-change-window-property", Fx_change_window_property
,
3311 Sx_change_window_property
, 2, 6, 0,
3312 doc
: /* Change window property PROP to VALUE on the X window of FRAME.
3313 VALUE may be a string or a list of conses, numbers and/or strings.
3314 If an element in the list is a string, it is converted to
3315 an Atom and the value of the Atom is used. If an element is a cons,
3316 it is converted to a 32 bit number where the car is the 16 top bits and the
3317 cdr is the lower 16 bits.
3318 FRAME nil or omitted means use the selected frame.
3319 If TYPE is given and non-nil, it is the name of the type of VALUE.
3320 If TYPE is not given or nil, the type is STRING.
3321 FORMAT gives the size in bits of each element if VALUE is a list.
3322 It must be one of 8, 16 or 32.
3323 If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
3324 If OUTER_P is non-nil, the property is changed for the outer X window of
3325 FRAME. Default is to change on the edit X window.
3328 (prop
, value
, frame
, type
, format
, outer_p
)
3329 Lisp_Object prop
, value
, frame
, type
, format
, outer_p
;
3331 #if 0 /* MAC_TODO : port window properties to Mac */
3332 struct frame
*f
= check_x_frame (frame
);
3335 CHECK_STRING (prop
);
3336 CHECK_STRING (value
);
3339 prop_atom
= XInternAtom (FRAME_W32_DISPLAY (f
), SDATA (prop
), False
);
3340 XChangeProperty (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
),
3341 prop_atom
, XA_STRING
, 8, PropModeReplace
,
3342 SDATA (value
), SCHARS (value
));
3344 /* Make sure the property is set when we return. */
3345 XFlush (FRAME_W32_DISPLAY (f
));
3348 #endif /* MAC_TODO */
3354 DEFUN ("x-delete-window-property", Fx_delete_window_property
,
3355 Sx_delete_window_property
, 1, 2, 0,
3356 doc
: /* Remove window property PROP from X window of FRAME.
3357 FRAME nil or omitted means use the selected frame. Value is PROP. */)
3359 Lisp_Object prop
, frame
;
3361 #if 0 /* MAC_TODO : port window properties to Mac */
3363 struct frame
*f
= check_x_frame (frame
);
3366 CHECK_STRING (prop
);
3368 prop_atom
= XInternAtom (FRAME_W32_DISPLAY (f
), SDATA (prop
), False
);
3369 XDeleteProperty (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
), prop_atom
);
3371 /* Make sure the property is removed when we return. */
3372 XFlush (FRAME_W32_DISPLAY (f
));
3374 #endif /* MAC_TODO */
3380 DEFUN ("x-window-property", Fx_window_property
, Sx_window_property
,
3382 doc
: /* Value is the value of window property PROP on FRAME.
3383 If FRAME is nil or omitted, use the selected frame. Value is nil
3384 if FRAME hasn't a property with name PROP or if PROP has no string
3387 Lisp_Object prop
, frame
;
3389 #if 0 /* MAC_TODO : port window properties to Mac */
3391 struct frame
*f
= check_x_frame (frame
);
3394 Lisp_Object prop_value
= Qnil
;
3395 char *tmp_data
= NULL
;
3398 unsigned long actual_size
, bytes_remaining
;
3400 CHECK_STRING (prop
);
3402 prop_atom
= XInternAtom (FRAME_W32_DISPLAY (f
), SDATA (prop
), False
);
3403 rc
= XGetWindowProperty (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
),
3404 prop_atom
, 0, 0, False
, XA_STRING
,
3405 &actual_type
, &actual_format
, &actual_size
,
3406 &bytes_remaining
, (unsigned char **) &tmp_data
);
3409 int size
= bytes_remaining
;
3414 rc
= XGetWindowProperty (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
),
3415 prop_atom
, 0, bytes_remaining
,
3417 &actual_type
, &actual_format
,
3418 &actual_size
, &bytes_remaining
,
3419 (unsigned char **) &tmp_data
);
3421 prop_value
= make_string (tmp_data
, size
);
3430 #endif /* MAC_TODO */
3436 /***********************************************************************
3438 ***********************************************************************/
3440 /* If non-null, an asynchronous timer that, when it expires, displays
3441 an hourglass cursor on all frames. */
3443 static struct atimer
*hourglass_atimer
;
3445 /* Non-zero means an hourglass cursor is currently shown. */
3447 static int hourglass_shown_p
;
3449 /* Number of seconds to wait before displaying an hourglass cursor. */
3451 static Lisp_Object Vhourglass_delay
;
3453 /* Default number of seconds to wait before displaying an hourglass
3456 #define DEFAULT_HOURGLASS_DELAY 1
3458 /* Function prototypes. */
3460 static void show_hourglass
P_ ((struct atimer
*));
3461 static void hide_hourglass
P_ ((void));
3464 /* Cancel a currently active hourglass timer, and start a new one. */
3469 #if 0 /* MAC_TODO: cursor shape changes. */
3471 int secs
, usecs
= 0;
3473 cancel_hourglass ();
3475 if (INTEGERP (Vhourglass_delay
)
3476 && XINT (Vhourglass_delay
) > 0)
3477 secs
= XFASTINT (Vhourglass_delay
);
3478 else if (FLOATP (Vhourglass_delay
)
3479 && XFLOAT_DATA (Vhourglass_delay
) > 0)
3482 tem
= Ftruncate (Vhourglass_delay
, Qnil
);
3483 secs
= XFASTINT (tem
);
3484 usecs
= (XFLOAT_DATA (Vhourglass_delay
) - secs
) * 1000000;
3487 secs
= DEFAULT_HOURGLASS_DELAY
;
3489 EMACS_SET_SECS_USECS (delay
, secs
, usecs
);
3490 hourglass_atimer
= start_atimer (ATIMER_RELATIVE
, delay
,
3491 show_hourglass
, NULL
);
3492 #endif /* MAC_TODO */
3496 /* Cancel the hourglass cursor timer if active, hide an hourglass
3502 if (hourglass_atimer
)
3504 cancel_atimer (hourglass_atimer
);
3505 hourglass_atimer
= NULL
;
3508 if (hourglass_shown_p
)
3513 /* Timer function of hourglass_atimer. TIMER is equal to
3516 Display an hourglass cursor on all frames by mapping the frames'
3517 hourglass_window. Set the hourglass_p flag in the frames'
3518 output_data.x structure to indicate that an hourglass cursor is
3519 shown on the frames. */
3522 show_hourglass (timer
)
3523 struct atimer
*timer
;
3525 #if 0 /* MAC_TODO: cursor shape changes. */
3526 /* The timer implementation will cancel this timer automatically
3527 after this function has run. Set hourglass_atimer to null
3528 so that we know the timer doesn't have to be canceled. */
3529 hourglass_atimer
= NULL
;
3531 if (!hourglass_shown_p
)
3533 Lisp_Object rest
, frame
;
3537 FOR_EACH_FRAME (rest
, frame
)
3538 if (FRAME_W32_P (XFRAME (frame
)))
3540 struct frame
*f
= XFRAME (frame
);
3542 f
->output_data
.w32
->hourglass_p
= 1;
3544 if (!f
->output_data
.w32
->hourglass_window
)
3546 unsigned long mask
= CWCursor
;
3547 XSetWindowAttributes attrs
;
3549 attrs
.cursor
= f
->output_data
.w32
->hourglass_cursor
;
3551 f
->output_data
.w32
->hourglass_window
3552 = XCreateWindow (FRAME_X_DISPLAY (f
),
3553 FRAME_OUTER_WINDOW (f
),
3554 0, 0, 32000, 32000, 0, 0,
3560 XMapRaised (FRAME_X_DISPLAY (f
),
3561 f
->output_data
.w32
->hourglass_window
);
3562 XFlush (FRAME_X_DISPLAY (f
));
3565 hourglass_shown_p
= 1;
3568 #endif /* MAC_TODO */
3572 /* Hide the hourglass cursor on all frames, if it is currently shown. */
3577 #if 0 /* MAC_TODO: cursor shape changes. */
3578 if (hourglass_shown_p
)
3580 Lisp_Object rest
, frame
;
3583 FOR_EACH_FRAME (rest
, frame
)
3585 struct frame
*f
= XFRAME (frame
);
3588 /* Watch out for newly created frames. */
3589 && f
->output_data
.x
->hourglass_window
)
3591 XUnmapWindow (FRAME_X_DISPLAY (f
),
3592 f
->output_data
.x
->hourglass_window
);
3593 /* Sync here because XTread_socket looks at the
3594 hourglass_p flag that is reset to zero below. */
3595 XSync (FRAME_X_DISPLAY (f
), False
);
3596 f
->output_data
.x
->hourglass_p
= 0;
3600 hourglass_shown_p
= 0;
3603 #endif /* MAC_TODO */
3608 /***********************************************************************
3610 ***********************************************************************/
3612 static Lisp_Object x_create_tip_frame
P_ ((struct mac_display_info
*,
3615 /* The frame of a currently visible tooltip, or null. */
3617 Lisp_Object tip_frame
;
3619 /* If non-nil, a timer started that hides the last tooltip when it
3622 Lisp_Object tip_timer
;
3625 /* If non-nil, a vector of 3 elements containing the last args
3626 with which x-show-tip was called. See there. */
3628 Lisp_Object last_show_tip_args
;
3630 /* Create a frame for a tooltip on the display described by DPYINFO.
3631 PARMS is a list of frame parameters. Value is the frame. */
3634 x_create_tip_frame (dpyinfo
, parms
)
3635 struct mac_display_info
*dpyinfo
;
3638 #if 0 /* MAC_TODO : Mac version */
3640 Lisp_Object frame
, tem
;
3642 long window_prompting
= 0;
3644 int count
= SPECPDL_INDEX ();
3645 struct gcpro gcpro1
, gcpro2
, gcpro3
;
3650 /* Use this general default value to start with until we know if
3651 this frame has a specified name. */
3652 Vx_resource_name
= Vinvocation_name
;
3655 kb
= dpyinfo
->kboard
;
3657 kb
= &the_only_kboard
;
3660 /* Get the name of the frame to use for resource lookup. */
3661 name
= w32_get_arg (parms
, Qname
, "name", "Name", RES_TYPE_STRING
);
3663 && !EQ (name
, Qunbound
)
3665 error ("Invalid frame name--not a string or nil");
3666 Vx_resource_name
= name
;
3669 GCPRO3 (parms
, name
, frame
);
3670 tip_frame
= f
= make_frame (1);
3671 XSETFRAME (frame
, f
);
3672 FRAME_CAN_HAVE_SCROLL_BARS (f
) = 0;
3674 f
->output_method
= output_w32
;
3675 f
->output_data
.w32
=
3676 (struct w32_output
*) xmalloc (sizeof (struct w32_output
));
3677 bzero (f
->output_data
.w32
, sizeof (struct w32_output
));
3679 f
->output_data
.w32
->icon_bitmap
= -1;
3681 FRAME_FONTSET (f
) = -1;
3682 f
->icon_name
= Qnil
;
3685 FRAME_KBOARD (f
) = kb
;
3687 f
->output_data
.w32
->parent_desc
= FRAME_W32_DISPLAY_INFO (f
)->root_window
;
3688 f
->output_data
.w32
->explicit_parent
= 0;
3690 /* Set the name; the functions to which we pass f expect the name to
3692 if (EQ (name
, Qunbound
) || NILP (name
))
3694 f
->name
= build_string (dpyinfo
->x_id_name
);
3695 f
->explicit_name
= 0;
3700 f
->explicit_name
= 1;
3701 /* use the frame's title when getting resources for this frame. */
3702 specbind (Qx_resource_name
, name
);
3705 /* Extract the window parameters from the supplied values
3706 that are needed to determine window geometry. */
3710 font
= w32_get_arg (parms
, Qfont
, "font", "Font", RES_TYPE_STRING
);
3713 /* First, try whatever font the caller has specified. */
3716 tem
= Fquery_fontset (font
, Qnil
);
3718 font
= x_new_fontset (f
, SDATA (tem
));
3720 font
= x_new_font (f
, SDATA (font
));
3723 /* Try out a font which we hope has bold and italic variations. */
3724 if (!STRINGP (font
))
3725 font
= x_new_font (f
, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
3726 if (!STRINGP (font
))
3727 font
= x_new_font (f
, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
3728 if (! STRINGP (font
))
3729 font
= x_new_font (f
, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
3730 if (! STRINGP (font
))
3731 /* This was formerly the first thing tried, but it finds too many fonts
3732 and takes too long. */
3733 font
= x_new_font (f
, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
3734 /* If those didn't work, look for something which will at least work. */
3735 if (! STRINGP (font
))
3736 font
= x_new_font (f
, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
3738 if (! STRINGP (font
))
3739 font
= build_string ("fixed");
3741 x_default_parameter (f
, parms
, Qfont
, font
,
3742 "font", "Font", RES_TYPE_STRING
);
3745 x_default_parameter (f
, parms
, Qborder_width
, make_number (2),
3746 "borderWidth", "BorderWidth", RES_TYPE_NUMBER
);
3748 /* This defaults to 2 in order to match xterm. We recognize either
3749 internalBorderWidth or internalBorder (which is what xterm calls
3751 if (NILP (Fassq (Qinternal_border_width
, parms
)))
3755 value
= w32_get_arg (parms
, Qinternal_border_width
,
3756 "internalBorder", "internalBorder", RES_TYPE_NUMBER
);
3757 if (! EQ (value
, Qunbound
))
3758 parms
= Fcons (Fcons (Qinternal_border_width
, value
),
3762 x_default_parameter (f
, parms
, Qinternal_border_width
, make_number (1),
3763 "internalBorderWidth", "internalBorderWidth",
3766 /* Also do the stuff which must be set before the window exists. */
3767 x_default_parameter (f
, parms
, Qforeground_color
, build_string ("black"),
3768 "foreground", "Foreground", RES_TYPE_STRING
);
3769 x_default_parameter (f
, parms
, Qbackground_color
, build_string ("white"),
3770 "background", "Background", RES_TYPE_STRING
);
3771 x_default_parameter (f
, parms
, Qmouse_color
, build_string ("black"),
3772 "pointerColor", "Foreground", RES_TYPE_STRING
);
3773 x_default_parameter (f
, parms
, Qcursor_color
, build_string ("black"),
3774 "cursorColor", "Foreground", RES_TYPE_STRING
);
3775 x_default_parameter (f
, parms
, Qborder_color
, build_string ("black"),
3776 "borderColor", "BorderColor", RES_TYPE_STRING
);
3778 /* Init faces before x_default_parameter is called for scroll-bar
3779 parameters because that function calls x_set_scroll_bar_width,
3780 which calls change_frame_size, which calls Fset_window_buffer,
3781 which runs hooks, which call Fvertical_motion. At the end, we
3782 end up in init_iterator with a null face cache, which should not
3784 init_frame_faces (f
);
3786 f
->output_data
.w32
->parent_desc
= FRAME_W32_DISPLAY_INFO (f
)->root_window
;
3788 window_prompting
= x_figure_window_size (f
, parms
, 0);
3791 XSetWindowAttributes attrs
;
3795 mask
= CWBackPixel
| CWOverrideRedirect
| CWSaveUnder
| CWEventMask
;
3796 /* Window managers looks at the override-redirect flag to
3797 determine whether or net to give windows a decoration (Xlib
3799 attrs
.override_redirect
= True
;
3800 attrs
.save_under
= True
;
3801 attrs
.background_pixel
= FRAME_BACKGROUND_PIXEL (f
);
3802 /* Arrange for getting MapNotify and UnmapNotify events. */
3803 attrs
.event_mask
= StructureNotifyMask
;
3805 = FRAME_W32_WINDOW (f
)
3806 = XCreateWindow (FRAME_W32_DISPLAY (f
),
3807 FRAME_W32_DISPLAY_INFO (f
)->root_window
,
3808 /* x, y, width, height */
3812 CopyFromParent
, InputOutput
, CopyFromParent
,
3819 x_default_parameter (f
, parms
, Qauto_raise
, Qnil
,
3820 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN
);
3821 x_default_parameter (f
, parms
, Qauto_lower
, Qnil
,
3822 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN
);
3823 x_default_parameter (f
, parms
, Qcursor_type
, Qbox
,
3824 "cursorType", "CursorType", RES_TYPE_SYMBOL
);
3826 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
3827 Change will not be effected unless different from the current
3829 width
= FRAME_COLS (f
);
3830 height
= FRAME_LINES (f
);
3831 FRAME_LINES (f
) = 0;
3832 SET_FRAME_COLS (f
, 0);
3833 change_frame_size (f
, height
, width
, 1, 0, 0);
3835 /* Add `tooltip' frame parameter's default value. */
3836 if (NILP (Fframe_parameter (frame
, intern ("tooltip"))))
3837 Fmodify_frame_parameters (frame
, Fcons (Fcons (intern ("tooltip"), Qt
),
3844 /* It is now ok to make the frame official even if we get an error
3845 below. And the frame needs to be on Vframe_list or making it
3846 visible won't work. */
3847 Vframe_list
= Fcons (frame
, Vframe_list
);
3849 /* Now that the frame is official, it counts as a reference to
3851 FRAME_W32_DISPLAY_INFO (f
)->reference_count
++;
3853 return unbind_to (count
, frame
);
3854 #endif /* MAC_TODO */
3859 DEFUN ("x-show-tip", Fx_show_tip
, Sx_show_tip
, 1, 6, 0,
3860 doc
: /* Show STRING in a "tooltip" window on frame FRAME.
3861 A tooltip window is a small window displaying a string.
3863 FRAME nil or omitted means use the selected frame.
3865 PARMS is an optional list of frame parameters which can be used to
3866 change the tooltip's appearance.
3868 Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
3869 means use the default timeout of 5 seconds.
3871 If the list of frame parameters PARAMS contains a `left' parameters,
3872 the tooltip is displayed at that x-position. Otherwise it is
3873 displayed at the mouse position, with offset DX added (default is 5 if
3874 DX isn't specified). Likewise for the y-position; if a `top' frame
3875 parameter is specified, it determines the y-position of the tooltip
3876 window, otherwise it is displayed at the mouse position, with offset
3877 DY added (default is 10). */)
3878 (string
, frame
, parms
, timeout
, dx
, dy
)
3879 Lisp_Object string
, frame
, parms
, timeout
, dx
, dy
;
3884 Lisp_Object buffer
, top
, left
;
3885 struct buffer
*old_buffer
;
3886 struct text_pos pos
;
3887 int i
, width
, height
;
3888 int root_x
, root_y
, win_x
, win_y
;
3890 struct gcpro gcpro1
, gcpro2
, gcpro3
, gcpro4
;
3891 int old_windows_or_buffers_changed
= windows_or_buffers_changed
;
3892 int count
= SPECPDL_INDEX ();
3894 specbind (Qinhibit_redisplay
, Qt
);
3896 GCPRO4 (string
, parms
, frame
, timeout
);
3898 CHECK_STRING (string
);
3899 f
= check_x_frame (frame
);
3901 timeout
= make_number (5);
3903 CHECK_NATNUM (timeout
);
3906 dx
= make_number (5);
3911 dy
= make_number (-10);
3915 if (NILP (last_show_tip_args
))
3916 last_show_tip_args
= Fmake_vector (make_number (3), Qnil
);
3918 if (!NILP (tip_frame
))
3920 Lisp_Object last_string
= AREF (last_show_tip_args
, 0);
3921 Lisp_Object last_frame
= AREF (last_show_tip_args
, 1);
3922 Lisp_Object last_parms
= AREF (last_show_tip_args
, 2);
3924 if (EQ (frame
, last_frame
)
3925 && !NILP (Fequal (last_string
, string
))
3926 && !NILP (Fequal (last_parms
, parms
)))
3928 struct frame
*f
= XFRAME (tip_frame
);
3930 /* Only DX and DY have changed. */
3931 if (!NILP (tip_timer
))
3933 Lisp_Object timer
= tip_timer
;
3935 call1 (Qcancel_timer
, timer
);
3938 #if 0 /* MAC_TODO : Mac specifics */
3940 compute_tip_xy (f
, parms
, dx
, dy
, &root_x
, &root_y
);
3941 XMoveWindow (FRAME_X_DISPLAY (f
), FRAME_X_WINDOW (f
),
3942 root_x
, root_y
- FRAME_PIXEL_HEIGHT (f
));
3944 #endif /* MAC_TODO */
3949 /* Hide a previous tip, if any. */
3952 ASET (last_show_tip_args
, 0, string
);
3953 ASET (last_show_tip_args
, 1, frame
);
3954 ASET (last_show_tip_args
, 2, parms
);
3956 /* Add default values to frame parameters. */
3957 if (NILP (Fassq (Qname
, parms
)))
3958 parms
= Fcons (Fcons (Qname
, build_string ("tooltip")), parms
);
3959 if (NILP (Fassq (Qinternal_border_width
, parms
)))
3960 parms
= Fcons (Fcons (Qinternal_border_width
, make_number (3)), parms
);
3961 if (NILP (Fassq (Qborder_width
, parms
)))
3962 parms
= Fcons (Fcons (Qborder_width
, make_number (1)), parms
);
3963 if (NILP (Fassq (Qborder_color
, parms
)))
3964 parms
= Fcons (Fcons (Qborder_color
, build_string ("lightyellow")), parms
);
3965 if (NILP (Fassq (Qbackground_color
, parms
)))
3966 parms
= Fcons (Fcons (Qbackground_color
, build_string ("lightyellow")),
3969 /* Create a frame for the tooltip, and record it in the global
3970 variable tip_frame. */
3971 frame
= x_create_tip_frame (FRAME_MAC_DISPLAY_INFO (f
), parms
);
3974 /* Set up the frame's root window. Currently we use a size of 80
3975 columns x 40 lines. If someone wants to show a larger tip, he
3976 will loose. I don't think this is a realistic case. */
3977 w
= XWINDOW (FRAME_ROOT_WINDOW (f
));
3978 w
->left_col
= w
->top_line
= make_number (0);
3979 w
->total_cols
= make_number (80);
3980 w
->total_lines
= make_number (40);
3982 w
->pseudo_window_p
= 1;
3984 /* Display the tooltip text in a temporary buffer. */
3985 buffer
= Fget_buffer_create (build_string (" *tip*"));
3986 Fset_window_buffer (FRAME_ROOT_WINDOW (f
), buffer
, Qnil
);
3987 old_buffer
= current_buffer
;
3988 set_buffer_internal_1 (XBUFFER (buffer
));
3990 Finsert (1, &string
);
3991 clear_glyph_matrix (w
->desired_matrix
);
3992 clear_glyph_matrix (w
->current_matrix
);
3993 SET_TEXT_POS (pos
, BEGV
, BEGV_BYTE
);
3994 try_window (FRAME_ROOT_WINDOW (f
), pos
);
3996 /* Compute width and height of the tooltip. */
3998 for (i
= 0; i
< w
->desired_matrix
->nrows
; ++i
)
4000 struct glyph_row
*row
= &w
->desired_matrix
->rows
[i
];
4004 /* Stop at the first empty row at the end. */
4005 if (!row
->enabled_p
|| !row
->displays_text_p
)
4008 /* Let the row go over the full width of the frame. */
4009 row
->full_width_p
= 1;
4011 /* There's a glyph at the end of rows that is use to place
4012 the cursor there. Don't include the width of this glyph. */
4013 if (row
->used
[TEXT_AREA
])
4015 last
= &row
->glyphs
[TEXT_AREA
][row
->used
[TEXT_AREA
] - 1];
4016 row_width
= row
->pixel_width
- last
->pixel_width
;
4019 row_width
= row
->pixel_width
;
4021 height
+= row
->height
;
4022 width
= max (width
, row_width
);
4025 /* Add the frame's internal border to the width and height the X
4026 window should have. */
4027 height
+= 2 * FRAME_INTERNAL_BORDER_WIDTH (f
);
4028 width
+= 2 * FRAME_INTERNAL_BORDER_WIDTH (f
);
4030 /* Move the tooltip window where the mouse pointer is. Resize and
4032 #if 0 /* TODO : Mac specifics */
4033 compute_tip_xy (f
, parms
, dx
, dy
, &root_x
, &root_y
);
4036 XQueryPointer (FRAME_W32_DISPLAY (f
), FRAME_W32_DISPLAY_INFO (f
)->root_window
,
4037 &root
, &child
, &root_x
, &root_y
, &win_x
, &win_y
, &pmask
);
4038 XMoveResizeWindow (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
),
4039 root_x
+ 5, root_y
- height
- 5, width
, height
);
4040 XMapRaised (FRAME_W32_DISPLAY (f
), FRAME_W32_WINDOW (f
));
4042 #endif /* MAC_TODO */
4044 /* Draw into the window. */
4045 w
->must_be_updated_p
= 1;
4046 update_single_window (w
, 1);
4048 /* Restore original current buffer. */
4049 set_buffer_internal_1 (old_buffer
);
4050 windows_or_buffers_changed
= old_windows_or_buffers_changed
;
4053 /* Let the tip disappear after timeout seconds. */
4054 tip_timer
= call3 (intern ("run-at-time"), timeout
, Qnil
,
4055 intern ("x-hide-tip"));
4058 return unbind_to (count
, Qnil
);
4062 DEFUN ("x-hide-tip", Fx_hide_tip
, Sx_hide_tip
, 0, 0, 0,
4063 doc
: /* Hide the current tooltip window, if there is any.
4064 Value is t is tooltip was open, nil otherwise. */)
4068 Lisp_Object deleted
, frame
, timer
;
4069 struct gcpro gcpro1
, gcpro2
;
4071 /* Return quickly if nothing to do. */
4072 if (NILP (tip_timer
) && NILP (tip_frame
))
4077 GCPRO2 (frame
, timer
);
4078 tip_frame
= tip_timer
= deleted
= Qnil
;
4080 count
= SPECPDL_INDEX ();
4081 specbind (Qinhibit_redisplay
, Qt
);
4082 specbind (Qinhibit_quit
, Qt
);
4085 call1 (Qcancel_timer
, timer
);
4089 Fdelete_frame (frame
, Qnil
);
4094 return unbind_to (count
, deleted
);
4099 /***********************************************************************
4100 File selection dialog
4101 ***********************************************************************/
4103 #if 0 /* MAC_TODO: can standard file dialog */
4104 extern Lisp_Object Qfile_name_history
;
4106 DEFUN ("x-file-dialog", Fx_file_dialog
, Sx_file_dialog
, 2, 4, 0,
4107 doc
: /* Read file name, prompting with PROMPT in directory DIR.
4108 Use a file selection dialog.
4109 Select DEFAULT-FILENAME in the dialog's file selection box, if
4110 specified. Don't let the user enter a file name in the file
4111 selection dialog's entry field, if MUSTMATCH is non-nil. */)
4112 (prompt
, dir
, default_filename
, mustmatch
)
4113 Lisp_Object prompt
, dir
, default_filename
, mustmatch
;
4115 struct frame
*f
= SELECTED_FRAME ();
4116 Lisp_Object file
= Qnil
;
4117 int count
= SPECPDL_INDEX ();
4118 struct gcpro gcpro1
, gcpro2
, gcpro3
, gcpro4
, gcpro5
;
4119 char filename
[MAX_PATH
+ 1];
4120 char init_dir
[MAX_PATH
+ 1];
4121 int use_dialog_p
= 1;
4123 GCPRO5 (prompt
, dir
, default_filename
, mustmatch
, file
);
4124 CHECK_STRING (prompt
);
4127 /* Create the dialog with PROMPT as title, using DIR as initial
4128 directory and using "*" as pattern. */
4129 dir
= Fexpand_file_name (dir
, Qnil
);
4130 strncpy (init_dir
, SDATA (dir
), MAX_PATH
);
4131 init_dir
[MAX_PATH
] = '\0';
4132 unixtodos_filename (init_dir
);
4134 if (STRINGP (default_filename
))
4136 char *file_name_only
;
4137 char *full_path_name
= SDATA (default_filename
);
4139 unixtodos_filename (full_path_name
);
4141 file_name_only
= strrchr (full_path_name
, '\\');
4142 if (!file_name_only
)
4143 file_name_only
= full_path_name
;
4148 /* If default_file_name is a directory, don't use the open
4149 file dialog, as it does not support selecting
4151 if (!(*file_name_only
))
4155 strncpy (filename
, file_name_only
, MAX_PATH
);
4156 filename
[MAX_PATH
] = '\0';
4163 OPENFILENAME file_details
;
4164 char *filename_file
;
4166 /* Prevent redisplay. */
4167 specbind (Qinhibit_redisplay
, Qt
);
4170 bzero (&file_details
, sizeof (file_details
));
4171 file_details
.lStructSize
= sizeof (file_details
);
4172 file_details
.hwndOwner
= FRAME_W32_WINDOW (f
);
4173 file_details
.lpstrFile
= filename
;
4174 file_details
.nMaxFile
= sizeof (filename
);
4175 file_details
.lpstrInitialDir
= init_dir
;
4176 file_details
.lpstrTitle
= SDATA (prompt
);
4177 file_details
.Flags
= OFN_HIDEREADONLY
| OFN_NOCHANGEDIR
;
4179 if (!NILP (mustmatch
))
4180 file_details
.Flags
|= OFN_FILEMUSTEXIST
| OFN_PATHMUSTEXIST
;
4182 if (GetOpenFileName (&file_details
))
4184 dostounix_filename (filename
);
4185 file
= build_string (filename
);
4191 file
= unbind_to (count
, file
);
4193 /* Open File dialog will not allow folders to be selected, so resort
4194 to minibuffer completing reads for directories. */
4196 file
= Fcompleting_read (prompt
, intern ("read-file-name-internal"),
4197 dir
, mustmatch
, dir
, Qfile_name_history
,
4198 default_filename
, Qnil
);
4202 /* Make "Cancel" equivalent to C-g. */
4204 Fsignal (Qquit
, Qnil
);
4206 return unbind_to (count
, file
);
4208 #endif /* MAC_TODO */
4212 /***********************************************************************
4214 ***********************************************************************/
4216 /* Keep this list in the same order as frame_parms in frame.c.
4217 Use 0 for unsupported frame parameters. */
4219 frame_parm_handler mac_frame_parm_handlers
[] =
4223 x_set_background_color
,
4229 x_set_foreground_color
,
4231 0, /* MAC_TODO: x_set_icon_type, */
4232 x_set_internal_border_width
,
4233 x_set_menu_bar_lines
,
4235 x_explicitly_set_name
,
4236 x_set_scroll_bar_width
,
4239 x_set_vertical_scroll_bars
,
4241 x_set_tool_bar_lines
,
4242 0, /* MAC_TODO: x_set_scroll_bar_foreground, */
4243 0, /* MAC_TODO: x_set_scroll_bar_background, */
4246 0, /* MAC_TODO: x_set_fringe_width, */
4247 0, /* MAC_TODO: x_set_fringe_width, */
4248 0, /* x_set_wait_for_wm, */
4249 0, /* MAC_TODO: x_set_fullscreen, */
4255 /* Certainly running on Mac. */
4258 /* The section below is built by the lisp expression at the top of the file,
4259 just above where these variables are declared. */
4260 /*&&& init symbols here &&&*/
4261 Qnone
= intern ("none");
4263 Qsuppress_icon
= intern ("suppress-icon");
4264 staticpro (&Qsuppress_icon
);
4265 Qundefined_color
= intern ("undefined-color");
4266 staticpro (&Qundefined_color
);
4267 /* This is the end of symbol initialization. */
4269 Qhyper
= intern ("hyper");
4270 staticpro (&Qhyper
);
4271 Qsuper
= intern ("super");
4272 staticpro (&Qsuper
);
4273 Qmeta
= intern ("meta");
4275 Qalt
= intern ("alt");
4277 Qctrl
= intern ("ctrl");
4279 Qcontrol
= intern ("control");
4280 staticpro (&Qcontrol
);
4281 Qshift
= intern ("shift");
4282 staticpro (&Qshift
);
4284 /* Text property `display' should be nonsticky by default. */
4285 Vtext_property_default_nonsticky
4286 = Fcons (Fcons (Qdisplay
, Qt
), Vtext_property_default_nonsticky
);
4288 Qface_set_after_frame_default
= intern ("face-set-after-frame-default");
4289 staticpro (&Qface_set_after_frame_default
);
4291 Fput (Qundefined_color
, Qerror_conditions
,
4292 Fcons (Qundefined_color
, Fcons (Qerror
, Qnil
)));
4293 Fput (Qundefined_color
, Qerror_message
,
4294 build_string ("Undefined color"));
4296 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape
,
4297 doc
: /* The shape of the pointer when over text.
4298 Changing the value does not affect existing frames
4299 unless you set the mouse color. */);
4300 Vx_pointer_shape
= Qnil
;
4302 Vx_nontext_pointer_shape
= Qnil
;
4304 Vx_mode_pointer_shape
= Qnil
;
4306 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape
,
4307 doc
: /* The shape of the pointer when Emacs is hourglass.
4308 This variable takes effect when you create a new frame
4309 or when you set the mouse color. */);
4310 Vx_hourglass_pointer_shape
= Qnil
;
4312 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p
,
4313 doc
: /* Non-zero means Emacs displays an hourglass pointer on window systems. */);
4314 display_hourglass_p
= 1;
4316 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay
,
4317 doc
: /* *Seconds to wait before displaying an hourglass pointer.
4318 Value must be an integer or float. */);
4319 Vhourglass_delay
= make_number (DEFAULT_HOURGLASS_DELAY
);
4321 DEFVAR_LISP ("x-sensitive-text-pointer-shape",
4322 &Vx_sensitive_text_pointer_shape
,
4323 doc
: /* The shape of the pointer when over mouse-sensitive text.
4324 This variable takes effect when you create a new frame
4325 or when you set the mouse color. */);
4326 Vx_sensitive_text_pointer_shape
= Qnil
;
4328 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel
,
4329 doc
: /* A string indicating the foreground color of the cursor box. */);
4330 Vx_cursor_fore_pixel
= Qnil
;
4332 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager
,
4333 doc
: /* Non-nil if no window manager is in use.
4334 Emacs doesn't try to figure this out; this is always nil
4335 unless you set it to something else. */);
4336 /* We don't have any way to find this out, so set it to nil
4337 and maybe the user would like to set it to t. */
4338 Vx_no_window_manager
= Qnil
;
4340 DEFVAR_LISP ("x-pixel-size-width-font-regexp",
4341 &Vx_pixel_size_width_font_regexp
,
4342 doc
: /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'.
4344 Since Emacs gets width of a font matching with this regexp from
4345 PIXEL_SIZE field of the name, font finding mechanism gets faster for
4346 such a font. This is especially effective for such large fonts as
4347 Chinese, Japanese, and Korean. */);
4348 Vx_pixel_size_width_font_regexp
= Qnil
;
4350 /* X window properties. */
4351 defsubr (&Sx_change_window_property
);
4352 defsubr (&Sx_delete_window_property
);
4353 defsubr (&Sx_window_property
);
4355 defsubr (&Sxw_display_color_p
);
4356 defsubr (&Sx_display_grayscale_p
);
4357 defsubr (&Sxw_color_defined_p
);
4358 defsubr (&Sxw_color_values
);
4359 defsubr (&Sx_server_max_request_size
);
4360 defsubr (&Sx_server_vendor
);
4361 defsubr (&Sx_server_version
);
4362 defsubr (&Sx_display_pixel_width
);
4363 defsubr (&Sx_display_pixel_height
);
4364 defsubr (&Sx_display_mm_width
);
4365 defsubr (&Sx_display_mm_height
);
4366 defsubr (&Sx_display_screens
);
4367 defsubr (&Sx_display_planes
);
4368 defsubr (&Sx_display_color_cells
);
4369 defsubr (&Sx_display_visual_class
);
4370 defsubr (&Sx_display_backing_store
);
4371 defsubr (&Sx_display_save_under
);
4372 defsubr (&Sx_create_frame
);
4373 #if 0 /* MAC_TODO: implement network support */
4374 defsubr (&Sx_open_connection
);
4375 defsubr (&Sx_close_connection
);
4377 defsubr (&Sx_display_list
);
4378 defsubr (&Sx_synchronize
);
4380 /* Setting callback functions for fontset handler. */
4381 get_font_info_func
= x_get_font_info
;
4383 #if 0 /* This function pointer doesn't seem to be used anywhere.
4384 And the pointer assigned has the wrong type, anyway. */
4385 list_fonts_func
= x_list_fonts
;
4388 load_font_func
= x_load_font
;
4389 find_ccl_program_func
= x_find_ccl_program
;
4390 query_font_func
= x_query_font
;
4391 set_frame_fontset_func
= x_set_font
;
4392 check_window_system_func
= check_mac
;
4394 hourglass_atimer
= NULL
;
4395 hourglass_shown_p
= 0;
4397 defsubr (&Sx_show_tip
);
4398 defsubr (&Sx_hide_tip
);
4400 staticpro (&tip_timer
);
4402 staticpro (&tip_frame
);
4404 #if 0 /* MAC_TODO */
4405 defsubr (&Sx_file_dialog
);
4409 /* arch-tag: d7591289-f374-4377-b245-12f5dbbb8edc
4410 (do not change this comment) */