annotate mac/src/macfns.c @ 43044:6253e4f3654b

(Emulation): pc-selection-mode is now a toggle.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 01 Feb 2002 13:12:44 +0000
parents bd613f1516d2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1 /* Graphical user interface functions for Mac OS.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2 Copyright (C) 2000 Free Software Foundation, Inc.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4 This file is part of GNU Emacs.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9 any later version.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
14 GNU General Public License for more details.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
15
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
20
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
21 /* Contributed by Andrew Choi (akochoi@users.sourceforge.net). */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
22
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
23 #include <config.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
24
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
25 #include <signal.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
26 #include <stdio.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
27 #include <math.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
28 #include <limits.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
29 #include <errno.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
30
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
31 #include "lisp.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
32 #include "charset.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
33 #include "macterm.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
34 #include "frame.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
35 #include "window.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
36 #include "buffer.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
37 #include "dispextern.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
38 #include "fontset.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
39 #include "intervals.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
40 #include "keyboard.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
41 #include "blockinput.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
42 #include "epaths.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
43 #include "termhooks.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
44 #include "coding.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
45 #include "ccl.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
46 #include "systime.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
47
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
48 /* #include "bitmaps/gray.xbm" */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
49 #define gray_width 2
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
50 #define gray_height 2
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
51 static unsigned char gray_bits[] = {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
52 0x01, 0x02};
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
53
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
54 /*#include <commdlg.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
55 #include <shellapi.h>*/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
56 #include <ctype.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
57
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
58 #include <stdlib.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
59 #include <string.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
60 #include <alloca.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
61 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
62 #include <unistd.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
63 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
64
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
65 #include <Windows.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
66 #include <Gestalt.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
67 #include <TextUtils.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
68
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
69 #ifndef min
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
70 #define min(a,b) ((a) < (b) ? (a) : (b))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
71 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
72 #ifndef max
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
73 #define max(a,b) ((a) > (b) ? (a) : (b))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
74 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
75
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
76 /*extern void free_frame_menubar ();
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
77 extern void x_compute_fringe_widths (struct frame *, int);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
78 extern double atof ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
79 extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
80 extern int quit_char;*/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
81
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
82 /* A definition of XColor for non-X frames. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
83 #ifndef HAVE_X_WINDOWS
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
84 typedef struct {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
85 unsigned long pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
86 unsigned short red, green, blue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
87 char flags;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
88 char pad;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
89 } XColor;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
90 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
91
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
92 extern char *lispy_function_keys[];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
93
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
94 /* The gray bitmap `bitmaps/gray'. This is done because macterm.c uses
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
95 it, and including `bitmaps/gray' more than once is a problem when
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
96 config.h defines `static' as an empty replacement string. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
97
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
98 int gray_bitmap_width = gray_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
99 int gray_bitmap_height = gray_height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
100 unsigned char *gray_bitmap_bits = gray_bits;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
101
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
102 /* The name we're using in resource queries. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
103
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
104 Lisp_Object Vx_resource_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
105
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
106 /* Non-zero means we're allowed to display an hourglass cursor. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
107
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
108 int display_hourglass_p;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
109
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
110 /* The background and shape of the mouse pointer, and shape when not
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
111 over text or in the modeline. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
112
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
113 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
114 Lisp_Object Vx_hourglass_pointer_shape;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
115
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
116 /* The shape when over mouse-sensitive text. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
117
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
118 Lisp_Object Vx_sensitive_text_pointer_shape;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
119
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
120 /* If non-nil, the pointer shape to indicate that windows can be
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
121 dragged horizontally. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
122
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
123 Lisp_Object Vx_window_horizontal_drag_shape;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
124
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
125 /* Color of chars displayed in cursor box. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
126
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
127 Lisp_Object Vx_cursor_fore_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
128
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
129 /* Nonzero if using Windows. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
130
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
131 static int mac_in_use;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
132
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
133 /* Non nil if no window manager is in use. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
134
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
135 Lisp_Object Vx_no_window_manager;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
136
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
137 /* Search path for bitmap files. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
138
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
139 Lisp_Object Vx_bitmap_file_path;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
140
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
141 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
142
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
143 Lisp_Object Vx_pixel_size_width_font_regexp;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
144
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
145 /* Evaluate this expression to rebuild the section of syms_of_macfns
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
146 that initializes and staticpros the symbols declared below. Note
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
147 that Emacs 18 has a bug that keeps C-x C-e from being able to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
148 evaluate this expression.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
149
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
150 (progn
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
151 ;; Accumulate a list of the symbols we want to initialize from the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
152 ;; declarations at the top of the file.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
153 (goto-char (point-min))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
154 (search-forward "/\*&&& symbols declared here &&&*\/\n")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
155 (let (symbol-list)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
156 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
157 (setq symbol-list
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
158 (cons (buffer-substring (match-beginning 1) (match-end 1))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
159 symbol-list))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
160 (forward-line 1))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
161 (setq symbol-list (nreverse symbol-list))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
162 ;; Delete the section of syms_of_... where we initialize the symbols.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
163 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
164 (let ((start (point)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
165 (while (looking-at "^ Q")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
166 (forward-line 2))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
167 (kill-region start (point)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
168 ;; Write a new symbol initialization section.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
169 (while symbol-list
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
170 (insert (format " %s = intern (\"" (car symbol-list)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
171 (let ((start (point)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
172 (insert (substring (car symbol-list) 1))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
173 (subst-char-in-region start (point) ?_ ?-))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
174 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
175 (setq symbol-list (cdr symbol-list)))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
176
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
177 */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
178
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
179 /*&&& symbols declared here &&&*/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
180 Lisp_Object Qauto_raise;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
181 Lisp_Object Qauto_lower;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
182 Lisp_Object Qbar;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
183 Lisp_Object Qborder_color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
184 Lisp_Object Qborder_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
185 Lisp_Object Qbox;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
186 Lisp_Object Qcursor_color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
187 Lisp_Object Qcursor_type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
188 Lisp_Object Qgeometry;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
189 Lisp_Object Qicon_left;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
190 Lisp_Object Qicon_top;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
191 Lisp_Object Qicon_type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
192 Lisp_Object Qicon_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
193 Lisp_Object Qinternal_border_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
194 Lisp_Object Qleft;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
195 Lisp_Object Qright;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
196 Lisp_Object Qmouse_color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
197 Lisp_Object Qnone;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
198 Lisp_Object Qparent_id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
199 Lisp_Object Qscroll_bar_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
200 Lisp_Object Qsuppress_icon;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
201 Lisp_Object Qundefined_color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
202 Lisp_Object Qvertical_scroll_bars;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
203 Lisp_Object Qvisibility;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
204 Lisp_Object Qwindow_id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
205 Lisp_Object Qx_frame_parameter;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
206 Lisp_Object Qx_resource_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
207 Lisp_Object Quser_position;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
208 Lisp_Object Quser_size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
209 Lisp_Object Qscreen_gamma;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
210 Lisp_Object Qline_spacing;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
211 Lisp_Object Qcenter;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
212 Lisp_Object Qcancel_timer;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
213 Lisp_Object Qhyper;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
214 Lisp_Object Qsuper;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
215 Lisp_Object Qmeta;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
216 Lisp_Object Qalt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
217 Lisp_Object Qctrl;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
218 Lisp_Object Qcontrol;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
219 Lisp_Object Qshift;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
220
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
221 extern Lisp_Object Qtop;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
222 extern Lisp_Object Qdisplay;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
223 Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
224 extern Lisp_Object Qtool_bar_lines;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
225
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
226 /* These are defined in frame.c. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
227 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
228 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
229 extern Lisp_Object Qtool_bar_lines;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
230
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
231 extern Lisp_Object Vwindow_system_version;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
232
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
233 Lisp_Object Qface_set_after_frame_default;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
234
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
235 /* Functions in macterm.c. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
236 extern void x_set_offset (struct frame *, int, int, int);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
237 extern void x_wm_set_icon_position (struct frame *, int, int);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
238 extern void x_display_cursor (struct window *, int, int, int, int, int);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
239 extern void x_set_window_size (struct frame *, int, int, int);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
240 extern void x_make_frame_visible (struct frame *);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
241 extern struct mac_display_info *x_term_init (Lisp_Object, char *, char *);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
242 extern struct font_info *x_get_font_info (FRAME_PTR, int);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
243 extern struct font_info *x_load_font (struct frame *, char *, int);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
244 extern void x_find_ccl_program (struct font_info *);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
245 extern struct font_info *x_query_font (struct frame *, char *);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
246
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
247
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
248 /* compare two strings ignoring case */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
249
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
250 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
251 stricmp (const char *s, const char *t)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
252 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
253 for ( ; tolower (*s) == tolower (*t); s++, t++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
254 if (*s == '\0')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
255 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
256 return tolower (*s) - tolower (*t);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
257 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
258
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
259 /* compare two strings up to n characters, ignoring case */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
260
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
261 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
262 strnicmp (const char *s, const char *t, unsigned int n)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
263 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
264 for ( ; n-- > 0 && tolower (*s) == tolower (*t); s++, t++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
265 if (*s == '\0')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
266 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
267 return n == 0 ? 0 : tolower (*s) - tolower (*t);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
268 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
269
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
270
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
271 /* Error if we are not running on Mac OS. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
272
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
273 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
274 check_mac ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
275 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
276 if (! mac_in_use)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
277 error ("Mac OS not in use or not initialized");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
278 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
279
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
280 /* Nonzero if we can use mouse menus.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
281 You should not call this unless HAVE_MENUS is defined. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
282
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
283 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
284 have_menus_p ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
285 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
286 return mac_in_use;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
287 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
288
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
289 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
290 and checking validity for Mac. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
291
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
292 FRAME_PTR
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
293 check_x_frame (frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
294 Lisp_Object frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
295 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
296 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
297
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
298 if (NILP (frame))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
299 frame = selected_frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
300 CHECK_LIVE_FRAME (frame, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
301 f = XFRAME (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
302 if (! FRAME_MAC_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
303 error ("non-mac frame used");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
304 return f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
305 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
306
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
307 /* Let the user specify an display with a frame.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
308 nil stands for the selected frame--or, if that is not a mac frame,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
309 the first display on the list. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
310
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
311 static struct mac_display_info *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
312 check_x_display_info (frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
313 Lisp_Object frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
314 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
315 if (NILP (frame))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
316 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
317 struct frame *sf = XFRAME (selected_frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
318
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
319 if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
320 return FRAME_MAC_DISPLAY_INFO (sf);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
321 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
322 return &one_mac_display_info;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
323 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
324 else if (STRINGP (frame))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
325 return x_display_info_for_name (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
326 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
327 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
328 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
329
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
330 CHECK_LIVE_FRAME (frame, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
331 f = XFRAME (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
332 if (! FRAME_MAC_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
333 error ("non-mac frame used");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
334 return FRAME_MAC_DISPLAY_INFO (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
335 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
336 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
337
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
338 /* Return the Emacs frame-object corresponding to an mac window.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
339 It could be the frame's main window or an icon window. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
340
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
341 /* This function can be called during GC, so use GC_xxx type test macros. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
342
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
343 struct frame *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
344 x_window_to_frame (dpyinfo, wdesc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
345 struct mac_display_info *dpyinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
346 WindowPtr wdesc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
347 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
348 Lisp_Object tail, frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
349 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
350
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
351 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
352 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
353 frame = XCAR (tail);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
354 if (!GC_FRAMEP (frame))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
355 continue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
356 f = XFRAME (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
357 if (!FRAME_W32_P (f) || FRAME_MAC_DISPLAY_INFO (f) != dpyinfo)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
358 continue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
359 /*if (f->output_data.w32->busy_window == wdesc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
360 return f;*/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
361
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
362 /* MAC_TODO: Check tooltips when supported. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
363 if (FRAME_MAC_WINDOW (f) == wdesc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
364 return f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
365 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
366 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
367 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
368
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
369
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
370
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
371 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
372 id, which is just an int that this section returns. Bitmaps are
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
373 reference counted so they can be shared among frames.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
374
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
375 Bitmap indices are guaranteed to be > 0, so a negative number can
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
376 be used to indicate no bitmap.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
377
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
378 If you use x_create_bitmap_from_data, then you must keep track of
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
379 the bitmaps yourself. That is, creating a bitmap from the same
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
380 data more than once will not be caught. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
381
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
382
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
383 /* Functions to access the contents of a bitmap, given an id. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
384
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
385 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
386 x_bitmap_height (f, id)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
387 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
388 int id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
389 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
390 return FRAME_MAC_DISPLAY_INFO (f)->bitmaps[id - 1].height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
391 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
392
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
393 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
394 x_bitmap_width (f, id)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
395 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
396 int id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
397 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
398 return FRAME_MAC_DISPLAY_INFO (f)->bitmaps[id - 1].width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
399 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
400
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
401 #if 0 /* MAC_TODO : not used anywhere (?) */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
402 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
403 x_bitmap_pixmap (f, id)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
404 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
405 int id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
406 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
407 return (int) FRAME_MAC_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
408 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
409 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
410
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
411 /* Allocate a new bitmap record. Returns index of new record. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
412
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
413 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
414 x_allocate_bitmap_record (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
415 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
416 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
417 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
418 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
419
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
420 if (dpyinfo->bitmaps == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
421 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
422 dpyinfo->bitmaps_size = 10;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
423 dpyinfo->bitmaps = (struct mac_bitmap_record *)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
424 xmalloc (dpyinfo->bitmaps_size * sizeof (struct mac_bitmap_record));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
425 dpyinfo->bitmaps_last = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
426 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
427 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
428
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
429 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
430 return ++dpyinfo->bitmaps_last;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
431
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
432 for (i = 0; i < dpyinfo->bitmaps_size; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
433 if (dpyinfo->bitmaps[i].refcount == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
434 return i + 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
435
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
436 dpyinfo->bitmaps_size *= 2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
437 dpyinfo->bitmaps = (struct mac_bitmap_record *)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
438 xrealloc (dpyinfo->bitmaps,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
439 dpyinfo->bitmaps_size * sizeof (struct mac_bitmap_record));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
440 return ++dpyinfo->bitmaps_last;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
441 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
442
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
443 /* Add one reference to the reference count of the bitmap with id
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
444 ID. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
445
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
446 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
447 x_reference_bitmap (f, id)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
448 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
449 int id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
450 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
451 ++FRAME_MAC_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
452 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
453
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
454 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
455 BITS. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
456
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
457 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
458 x_create_bitmap_from_data (f, bits, width, height)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
459 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
460 char *bits;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
461 unsigned int width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
462 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
463 struct x_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
464 int id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
465
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
466 /* MAC_TODO: for now fail if width is not mod 16 (toolbox requires it) */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
467
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
468 id = x_allocate_bitmap_record (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
469
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
470 if (width % 16 != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
471 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
472
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
473 dpyinfo->bitmaps[id - 1].bitmap_data = (char *) xmalloc (height * width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
474 if (! dpyinfo->bitmaps[id - 1].bitmap_data)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
475 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
476
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
477 bcopy (bits, dpyinfo->bitmaps[id - 1].bitmap_data, height * width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
478
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
479 dpyinfo->bitmaps[id - 1].refcount = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
480 dpyinfo->bitmaps[id - 1].height = height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
481 dpyinfo->bitmaps[id - 1].width = width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
482
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
483 return id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
484 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
485
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
486 /* Create bitmap from file FILE for frame F. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
487
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
488 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
489 x_create_bitmap_from_file (f, file)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
490 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
491 Lisp_Object file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
492 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
493 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
494 #if 0 /* MAC_TODO : bitmap support */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
495 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
496 unsigned int width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
497 HBITMAP bitmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
498 int xhot, yhot, result, id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
499 Lisp_Object found;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
500 int fd;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
501 char *filename;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
502 HINSTANCE hinst;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
503
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
504 /* Look for an existing bitmap with the same name. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
505 for (id = 0; id < dpyinfo->bitmaps_last; ++id)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
506 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
507 if (dpyinfo->bitmaps[id].refcount
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
508 && dpyinfo->bitmaps[id].file
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
509 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
510 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
511 ++dpyinfo->bitmaps[id].refcount;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
512 return id + 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
513 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
514 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
515
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
516 /* Search bitmap-file-path for the file, if appropriate. */
39812
66e0816837a8 Update calls to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36417
diff changeset
517 fd = openp (Vx_bitmap_file_path, file, Qnil, &found, 0);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
518 if (fd < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
519 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
520 /* LoadLibraryEx won't handle special files handled by Emacs handler. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
521 if (fd == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
522 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
523 emacs_close (fd);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
524
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
525 filename = (char *) XSTRING (found)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
526
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
527 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
528
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
529 if (hinst == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
530 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
531
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
532
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
533 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
534 filename, &width, &height, &bitmap, &xhot, &yhot);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
535 if (result != BitmapSuccess)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
536 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
537
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
538 id = x_allocate_bitmap_record (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
539 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
540 dpyinfo->bitmaps[id - 1].refcount = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
541 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
542 dpyinfo->bitmaps[id - 1].depth = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
543 dpyinfo->bitmaps[id - 1].height = height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
544 dpyinfo->bitmaps[id - 1].width = width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
545 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
546
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
547 return id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
548 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
549 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
550
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
551 /* Remove reference to bitmap with id number ID. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
552
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
553 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
554 x_destroy_bitmap (f, id)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
555 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
556 int id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
557 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
558 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
559
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
560 if (id > 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
561 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
562 --dpyinfo->bitmaps[id - 1].refcount;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
563 if (dpyinfo->bitmaps[id - 1].refcount == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
564 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
565 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
566 dpyinfo->bitmaps[id - 1].bitmap_data = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
567 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
568 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
569 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
570 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
571
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
572 /* Free all the bitmaps for the display specified by DPYINFO. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
573
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
574 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
575 x_destroy_all_bitmaps (dpyinfo)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
576 struct mac_display_info *dpyinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
577 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
578 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
579 for (i = 0; i < dpyinfo->bitmaps_last; i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
580 if (dpyinfo->bitmaps[i].refcount > 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
581 xfree (dpyinfo->bitmaps[i].bitmap_data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
582 dpyinfo->bitmaps_last = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
583 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
584
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
585 /* Connect the frame-parameter names for W32 frames
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
586 to the ways of passing the parameter values to the window system.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
587
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
588 The name of a parameter, as a Lisp symbol,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
589 has an `x-frame-parameter' property which is an integer in Lisp
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
590 but can be interpreted as an `enum x_frame_parm' in C. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
591
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
592 struct x_frame_parm_table
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
593 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
594 char *name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
595 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
596 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
597
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
598 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
599 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
600 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
601 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
602 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
603 void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
604 void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
605 void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
606 void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
607 void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object));
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
608 static void x_set_fringe_width P_ ((struct frame *, Lisp_Object, Lisp_Object));
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
609 void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
610 void x_set_internal_border_width P_ ((struct frame *, Lisp_Object,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
611 Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
612 void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
613 void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
614 void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
615 void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
616 Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
617 void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
618 void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
619 void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
620 void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
621 void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
622 void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
623 void x_set_scroll_bar_foreground P_ ((struct frame *, Lisp_Object,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
624 Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
625 void x_set_scroll_bar_background P_ ((struct frame *, Lisp_Object,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
626 Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
627 static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
628 Lisp_Object,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
629 Lisp_Object,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
630 char *, char *,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
631 int));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
632 static void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
633
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
634 static struct x_frame_parm_table x_frame_parms[] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
635 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
636 "auto-raise", x_set_autoraise,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
637 "auto-lower", x_set_autolower,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
638 "background-color", x_set_background_color,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
639 "border-color", x_set_border_color,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
640 "border-width", x_set_border_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
641 "cursor-color", x_set_cursor_color,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
642 "cursor-type", x_set_cursor_type,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
643 "font", x_set_font,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
644 "foreground-color", x_set_foreground_color,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
645 "icon-name", x_set_icon_name,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
646 #if 0 /* MAC_TODO: no icons for Mac */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
647 "icon-type", x_set_icon_type,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
648 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
649 "internal-border-width", x_set_internal_border_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
650 "menu-bar-lines", x_set_menu_bar_lines,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
651 "mouse-color", x_set_mouse_color,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
652 "name", x_explicitly_set_name,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
653 "scroll-bar-width", x_set_scroll_bar_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
654 "title", x_set_title,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
655 "unsplittable", x_set_unsplittable,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
656 "vertical-scroll-bars", x_set_vertical_scroll_bars,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
657 "visibility", x_set_visibility,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
658 "tool-bar-lines", x_set_tool_bar_lines,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
659 #if 0 /* MAC_TODO: cannot set color of scroll bar on the Mac? */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
660 "scroll-bar-foreground", x_set_scroll_bar_foreground,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
661 "scroll-bar-background", x_set_scroll_bar_background,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
662 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
663 "screen-gamma", x_set_screen_gamma,
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
664 "line-spacing", x_set_line_spacing,
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
665 "left-fringe", x_set_fringe_width,
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
666 "right-fringe", x_set_fringe_width
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
667 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
668
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
669 /* Attach the `x-frame-parameter' properties to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
670 the Lisp symbol names of parameters relevant to Mac. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
671
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
672 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
673 init_x_parm_symbols ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
674 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
675 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
676
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
677 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
678 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
679 make_number (i));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
680 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
681
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
682 /* Change the parameters of frame F as specified by ALIST.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
683 If a parameter is not specially recognized, do nothing;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
684 otherwise call the `x_set_...' function for that parameter. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
685
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
686 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
687 x_set_frame_parameters (f, alist)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
688 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
689 Lisp_Object alist;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
690 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
691 Lisp_Object tail;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
692
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
693 /* If both of these parameters are present, it's more efficient to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
694 set them both at once. So we wait until we've looked at the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
695 entire list before we set them. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
696 int width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
697
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
698 /* Same here. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
699 Lisp_Object left, top;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
700
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
701 /* Same with these. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
702 Lisp_Object icon_left, icon_top;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
703
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
704 /* Record in these vectors all the parms specified. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
705 Lisp_Object *parms;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
706 Lisp_Object *values;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
707 int i, p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
708 int left_no_change = 0, top_no_change = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
709 int icon_left_no_change = 0, icon_top_no_change = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
710
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
711 struct gcpro gcpro1, gcpro2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
712
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
713 i = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
714 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
715 i++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
716
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
717 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
718 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
719
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
720 /* Extract parm names and values into those vectors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
721
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
722 i = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
723 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
724 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
725 Lisp_Object elt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
726
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
727 elt = Fcar (tail);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
728 parms[i] = Fcar (elt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
729 values[i] = Fcdr (elt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
730 i++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
731 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
732 /* TAIL and ALIST are not used again below here. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
733 alist = tail = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
734
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
735 GCPRO2 (*parms, *values);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
736 gcpro1.nvars = i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
737 gcpro2.nvars = i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
738
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
739 /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
740 because their values appear in VALUES and strings are not valid. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
741 top = left = Qunbound;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
742 icon_left = icon_top = Qunbound;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
743
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
744 /* Provide default values for HEIGHT and WIDTH. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
745 if (FRAME_NEW_WIDTH (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
746 width = FRAME_NEW_WIDTH (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
747 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
748 width = FRAME_WIDTH (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
749
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
750 if (FRAME_NEW_HEIGHT (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
751 height = FRAME_NEW_HEIGHT (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
752 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
753 height = FRAME_HEIGHT (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
754
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
755 /* Process foreground_color and background_color before anything else.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
756 They are independent of other properties, but other properties (e.g.,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
757 cursor_color) are dependent upon them. */
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
758 /* Process default font as well, since fringe widths depends on it. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
759 for (p = 0; p < i; p++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
760 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
761 Lisp_Object prop, val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
762
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
763 prop = parms[p];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
764 val = values[p];
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
765 if (EQ (prop, Qforeground_color)
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
766 || EQ (prop, Qbackground_color)
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
767 || EQ (prop, Qfont))
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
768 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
769 register Lisp_Object param_index, old_value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
770
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
771 param_index = Fget (prop, Qx_frame_parameter);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
772 old_value = get_frame_param (f, prop);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
773 store_frame_param (f, prop, val);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
774 if (NATNUMP (param_index)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
775 && (XFASTINT (param_index)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
776 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
777 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
778 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
779 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
780
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
781 /* Now process them in reverse of specified order. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
782 for (i--; i >= 0; i--)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
783 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
784 Lisp_Object prop, val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
785
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
786 prop = parms[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
787 val = values[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
788
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
789 if (EQ (prop, Qwidth) && NUMBERP (val))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
790 width = XFASTINT (val);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
791 else if (EQ (prop, Qheight) && NUMBERP (val))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
792 height = XFASTINT (val);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
793 else if (EQ (prop, Qtop))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
794 top = val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
795 else if (EQ (prop, Qleft))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
796 left = val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
797 else if (EQ (prop, Qicon_top))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
798 icon_top = val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
799 else if (EQ (prop, Qicon_left))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
800 icon_left = val;
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
801 else if (EQ (prop, Qforeground_color)
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
802 || EQ (prop, Qbackground_color)
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
803 || EQ (prop, Qfont))
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
804 /* Processed above. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
805 continue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
806 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
807 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
808 register Lisp_Object param_index, old_value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
809
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
810 param_index = Fget (prop, Qx_frame_parameter);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
811 old_value = get_frame_param (f, prop);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
812 store_frame_param (f, prop, val);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
813 if (NATNUMP (param_index)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
814 && (XFASTINT (param_index)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
815 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
816 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
817 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
818 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
819
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
820 /* Don't die if just one of these was set. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
821 if (EQ (left, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
822 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
823 left_no_change = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
824 if (f->output_data.mac->left_pos < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
825 left = Fcons (Qplus,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
826 Fcons (make_number (f->output_data.mac->left_pos),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
827 Qnil));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
828 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
829 XSETINT (left, f->output_data.mac->left_pos);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
830 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
831 if (EQ (top, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
832 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
833 top_no_change = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
834 if (f->output_data.mac->top_pos < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
835 top = Fcons (Qplus,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
836 Fcons (make_number (f->output_data.mac->top_pos), Qnil));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
837 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
838 XSETINT (top, f->output_data.mac->top_pos);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
839 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
840
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
841 /* If one of the icon positions was not set, preserve or default it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
842 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
843 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
844 icon_left_no_change = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
845 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
846 if (NILP (icon_left))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
847 XSETINT (icon_left, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
848 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
849 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
850 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
851 icon_top_no_change = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
852 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
853 if (NILP (icon_top))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
854 XSETINT (icon_top, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
855 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
856
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
857 /* Don't set these parameters unless they've been explicitly
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
858 specified. The window might be mapped or resized while we're in
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
859 this function, and we don't want to override that unless the lisp
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
860 code has asked for it.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
861
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
862 Don't set these parameters unless they actually differ from the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
863 window's current parameters; the window may not actually exist
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
864 yet. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
865 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
866 Lisp_Object frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
867
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
868 check_frame_size (f, &height, &width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
869
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
870 XSETFRAME (frame, f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
871
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
872 if (width != FRAME_WIDTH (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
873 || height != FRAME_HEIGHT (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
874 || FRAME_NEW_HEIGHT (f) || FRAME_NEW_WIDTH (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
875 Fset_frame_size (frame, make_number (width), make_number (height));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
876
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
877 if ((!NILP (left) || !NILP (top))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
878 && ! (left_no_change && top_no_change)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
879 && ! (NUMBERP (left) && XINT (left) == f->output_data.mac->left_pos
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
880 && NUMBERP (top) && XINT (top) == f->output_data.mac->top_pos))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
881 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
882 int leftpos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
883 int toppos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
884
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
885 /* Record the signs. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
886 f->output_data.mac->size_hint_flags &= ~ (XNegative | YNegative);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
887 if (EQ (left, Qminus))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
888 f->output_data.mac->size_hint_flags |= XNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
889 else if (INTEGERP (left))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
890 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
891 leftpos = XINT (left);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
892 if (leftpos < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
893 f->output_data.mac->size_hint_flags |= XNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
894 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
895 else if (CONSP (left) && EQ (XCAR (left), Qminus)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
896 && CONSP (XCDR (left))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
897 && INTEGERP (XCAR (XCDR (left))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
898 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
899 leftpos = - XINT (XCAR (XCDR (left)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
900 f->output_data.mac->size_hint_flags |= XNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
901 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
902 else if (CONSP (left) && EQ (XCAR (left), Qplus)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
903 && CONSP (XCDR (left))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
904 && INTEGERP (XCAR (XCDR (left))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
905 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
906 leftpos = XINT (XCAR (XCDR (left)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
907 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
908
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
909 if (EQ (top, Qminus))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
910 f->output_data.mac->size_hint_flags |= YNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
911 else if (INTEGERP (top))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
912 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
913 toppos = XINT (top);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
914 if (toppos < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
915 f->output_data.mac->size_hint_flags |= YNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
916 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
917 else if (CONSP (top) && EQ (XCAR (top), Qminus)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
918 && CONSP (XCDR (top))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
919 && INTEGERP (XCAR (XCDR (top))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
920 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
921 toppos = - XINT (XCAR (XCDR (top)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
922 f->output_data.mac->size_hint_flags |= YNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
923 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
924 else if (CONSP (top) && EQ (XCAR (top), Qplus)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
925 && CONSP (XCDR (top))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
926 && INTEGERP (XCAR (XCDR (top))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
927 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
928 toppos = XINT (XCAR (XCDR (top)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
929 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
930
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
931
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
932 /* Store the numeric value of the position. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
933 f->output_data.mac->top_pos = toppos;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
934 f->output_data.mac->left_pos = leftpos;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
935
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
936 f->output_data.mac->win_gravity = NorthWestGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
937
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
938 /* Actually set that position, and convert to absolute. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
939 x_set_offset (f, leftpos, toppos, -1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
940 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
941
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
942 if ((!NILP (icon_left) || !NILP (icon_top))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
943 && ! (icon_left_no_change && icon_top_no_change))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
944 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
945 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
946
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
947 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
948 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
949
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
950 /* Store the screen positions of frame F into XPTR and YPTR.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
951 These are the positions of the containing window manager window,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
952 not Emacs's own window. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
953
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
954 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
955 x_real_positions (f, xptr, yptr)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
956 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
957 int *xptr, *yptr;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
958 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
959 Point pt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
960 GrafPtr oldport;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
961
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
962 SetPt (&pt,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
963 f->output_data.mac->mWP->portRect.left,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
964 f->output_data.mac->mWP->portRect.top);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
965 GetPort (&oldport);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
966 LocalToGlobal (&pt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
967 SetPort (oldport);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
968
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
969 *xptr = pt.h;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
970 *yptr = pt.v;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
971 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
972
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
973 /* Insert a description of internally-recorded parameters of frame X
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
974 into the parameter alist *ALISTPTR that is to be given to the user.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
975 Only parameters that are specific to Mac and whose values are not
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
976 correctly recorded in the frame's param_alist need to be considered
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
977 here. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
978
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
979 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
980 x_report_frame_params (f, alistptr)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
981 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
982 Lisp_Object *alistptr;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
983 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
984 char buf[16];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
985 Lisp_Object tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
986
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
987 /* Represent negative positions (off the top or left screen edge)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
988 in a way that Fmodify_frame_parameters will understand correctly. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
989 XSETINT (tem, f->output_data.mac->left_pos);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
990 if (f->output_data.mac->left_pos >= 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
991 store_in_alist (alistptr, Qleft, tem);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
992 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
993 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
994
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
995 XSETINT (tem, f->output_data.mac->top_pos);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
996 if (f->output_data.mac->top_pos >= 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
997 store_in_alist (alistptr, Qtop, tem);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
998 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
999 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1000
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1001 store_in_alist (alistptr, Qborder_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1002 make_number (f->output_data.mac->border_width));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1003 store_in_alist (alistptr, Qinternal_border_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1004 make_number (f->output_data.mac->internal_border_width));
41834
efe03af8f775 (x_report_frame_params): Return actual fringe widths.
Kim F. Storm <storm@cua.dk>
parents: 41726
diff changeset
1005 store_in_alist (alistptr, Qleft_fringe,
efe03af8f775 (x_report_frame_params): Return actual fringe widths.
Kim F. Storm <storm@cua.dk>
parents: 41726
diff changeset
1006 make_number (f->output_data.mac->left_fringe_width));
efe03af8f775 (x_report_frame_params): Return actual fringe widths.
Kim F. Storm <storm@cua.dk>
parents: 41726
diff changeset
1007 store_in_alist (alistptr, Qright_fringe,
efe03af8f775 (x_report_frame_params): Return actual fringe widths.
Kim F. Storm <storm@cua.dk>
parents: 41726
diff changeset
1008 make_number (f->output_data.mac->right_fringe_width));
42008
bd613f1516d2 (x_report_frame_params): Makes the scroll-bar-width frame
Eli Zaretskii <eliz@gnu.org>
parents: 41834
diff changeset
1009 store_in_alist (alistptr, Qscroll_bar_width,
bd613f1516d2 (x_report_frame_params): Makes the scroll-bar-width frame
Eli Zaretskii <eliz@gnu.org>
parents: 41834
diff changeset
1010 make_number (FRAME_HAS_VERTICAL_SCROLL_BARS (f)
bd613f1516d2 (x_report_frame_params): Makes the scroll-bar-width frame
Eli Zaretskii <eliz@gnu.org>
parents: 41834
diff changeset
1011 ? FRAME_SCROLL_BAR_PIXEL_WIDTH(f)
bd613f1516d2 (x_report_frame_params): Makes the scroll-bar-width frame
Eli Zaretskii <eliz@gnu.org>
parents: 41834
diff changeset
1012 : 0));
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1013 sprintf (buf, "%ld", (long) FRAME_MAC_WINDOW (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1014 store_in_alist (alistptr, Qwindow_id,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1015 build_string (buf));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1016 store_in_alist (alistptr, Qicon_name, f->icon_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1017 FRAME_SAMPLE_VISIBILITY (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1018 store_in_alist (alistptr, Qvisibility,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1019 (FRAME_VISIBLE_P (f) ? Qt
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1020 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1021 store_in_alist (alistptr, Qdisplay,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1022 XCAR (FRAME_MAC_DISPLAY_INFO (f)->name_list_element));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1023 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1024
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1025 /* The default colors for the Mac color map */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1026 typedef struct colormap_t
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1027 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1028 unsigned long color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1029 char *name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1030 } colormap_t;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1031
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1032 colormap_t mac_color_map[] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1033 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1034 { RGB_TO_ULONG(255, 250, 250), "snow" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1035 { RGB_TO_ULONG(248, 248, 255), "ghost white" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1036 { RGB_TO_ULONG(248, 248, 255), "GhostWhite" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1037 { RGB_TO_ULONG(245, 245, 245), "white smoke" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1038 { RGB_TO_ULONG(245, 245, 245), "WhiteSmoke" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1039 { RGB_TO_ULONG(220, 220, 220), "gainsboro" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1040 { RGB_TO_ULONG(255, 250, 240), "floral white" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1041 { RGB_TO_ULONG(255, 250, 240), "FloralWhite" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1042 { RGB_TO_ULONG(253, 245, 230), "old lace" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1043 { RGB_TO_ULONG(253, 245, 230), "OldLace" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1044 { RGB_TO_ULONG(250, 240, 230), "linen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1045 { RGB_TO_ULONG(250, 235, 215), "antique white" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1046 { RGB_TO_ULONG(250, 235, 215), "AntiqueWhite" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1047 { RGB_TO_ULONG(255, 239, 213), "papaya whip" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1048 { RGB_TO_ULONG(255, 239, 213), "PapayaWhip" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1049 { RGB_TO_ULONG(255, 235, 205), "blanched almond" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1050 { RGB_TO_ULONG(255, 235, 205), "BlanchedAlmond" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1051 { RGB_TO_ULONG(255, 228, 196), "bisque" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1052 { RGB_TO_ULONG(255, 218, 185), "peach puff" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1053 { RGB_TO_ULONG(255, 218, 185), "PeachPuff" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1054 { RGB_TO_ULONG(255, 222, 173), "navajo white" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1055 { RGB_TO_ULONG(255, 222, 173), "NavajoWhite" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1056 { RGB_TO_ULONG(255, 228, 181), "moccasin" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1057 { RGB_TO_ULONG(255, 248, 220), "cornsilk" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1058 { RGB_TO_ULONG(255, 255, 240), "ivory" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1059 { RGB_TO_ULONG(255, 250, 205), "lemon chiffon" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1060 { RGB_TO_ULONG(255, 250, 205), "LemonChiffon" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1061 { RGB_TO_ULONG(255, 245, 238), "seashell" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1062 { RGB_TO_ULONG(240, 255, 240), "honeydew" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1063 { RGB_TO_ULONG(245, 255, 250), "mint cream" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1064 { RGB_TO_ULONG(245, 255, 250), "MintCream" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1065 { RGB_TO_ULONG(240, 255, 255), "azure" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1066 { RGB_TO_ULONG(240, 248, 255), "alice blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1067 { RGB_TO_ULONG(240, 248, 255), "AliceBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1068 { RGB_TO_ULONG(230, 230, 250), "lavender" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1069 { RGB_TO_ULONG(255, 240, 245), "lavender blush" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1070 { RGB_TO_ULONG(255, 240, 245), "LavenderBlush" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1071 { RGB_TO_ULONG(255, 228, 225), "misty rose" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1072 { RGB_TO_ULONG(255, 228, 225), "MistyRose" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1073 { RGB_TO_ULONG(255, 255, 255), "white" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1074 { RGB_TO_ULONG(0 , 0 , 0 ), "black" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1075 { RGB_TO_ULONG(47 , 79 , 79 ), "dark slate gray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1076 { RGB_TO_ULONG(47 , 79 , 79 ), "DarkSlateGray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1077 { RGB_TO_ULONG(47 , 79 , 79 ), "dark slate grey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1078 { RGB_TO_ULONG(47 , 79 , 79 ), "DarkSlateGrey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1079 { RGB_TO_ULONG(105, 105, 105), "dim gray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1080 { RGB_TO_ULONG(105, 105, 105), "DimGray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1081 { RGB_TO_ULONG(105, 105, 105), "dim grey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1082 { RGB_TO_ULONG(105, 105, 105), "DimGrey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1083 { RGB_TO_ULONG(112, 128, 144), "slate gray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1084 { RGB_TO_ULONG(112, 128, 144), "SlateGray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1085 { RGB_TO_ULONG(112, 128, 144), "slate grey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1086 { RGB_TO_ULONG(112, 128, 144), "SlateGrey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1087 { RGB_TO_ULONG(119, 136, 153), "light slate gray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1088 { RGB_TO_ULONG(119, 136, 153), "LightSlateGray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1089 { RGB_TO_ULONG(119, 136, 153), "light slate grey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1090 { RGB_TO_ULONG(119, 136, 153), "LightSlateGrey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1091 { RGB_TO_ULONG(190, 190, 190), "gray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1092 { RGB_TO_ULONG(190, 190, 190), "grey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1093 { RGB_TO_ULONG(211, 211, 211), "light grey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1094 { RGB_TO_ULONG(211, 211, 211), "LightGrey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1095 { RGB_TO_ULONG(211, 211, 211), "light gray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1096 { RGB_TO_ULONG(211, 211, 211), "LightGray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1097 { RGB_TO_ULONG(25 , 25 , 112), "midnight blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1098 { RGB_TO_ULONG(25 , 25 , 112), "MidnightBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1099 { RGB_TO_ULONG(0 , 0 , 128), "navy" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1100 { RGB_TO_ULONG(0 , 0 , 128), "navy blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1101 { RGB_TO_ULONG(0 , 0 , 128), "NavyBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1102 { RGB_TO_ULONG(100, 149, 237), "cornflower blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1103 { RGB_TO_ULONG(100, 149, 237), "CornflowerBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1104 { RGB_TO_ULONG(72 , 61 , 139), "dark slate blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1105 { RGB_TO_ULONG(72 , 61 , 139), "DarkSlateBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1106 { RGB_TO_ULONG(106, 90 , 205), "slate blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1107 { RGB_TO_ULONG(106, 90 , 205), "SlateBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1108 { RGB_TO_ULONG(123, 104, 238), "medium slate blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1109 { RGB_TO_ULONG(123, 104, 238), "MediumSlateBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1110 { RGB_TO_ULONG(132, 112, 255), "light slate blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1111 { RGB_TO_ULONG(132, 112, 255), "LightSlateBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1112 { RGB_TO_ULONG(0 , 0 , 205), "medium blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1113 { RGB_TO_ULONG(0 , 0 , 205), "MediumBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1114 { RGB_TO_ULONG(65 , 105, 225), "royal blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1115 { RGB_TO_ULONG(65 , 105, 225), "RoyalBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1116 { RGB_TO_ULONG(0 , 0 , 255), "blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1117 { RGB_TO_ULONG(30 , 144, 255), "dodger blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1118 { RGB_TO_ULONG(30 , 144, 255), "DodgerBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1119 { RGB_TO_ULONG(0 , 191, 255), "deep sky blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1120 { RGB_TO_ULONG(0 , 191, 255), "DeepSkyBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1121 { RGB_TO_ULONG(135, 206, 235), "sky blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1122 { RGB_TO_ULONG(135, 206, 235), "SkyBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1123 { RGB_TO_ULONG(135, 206, 250), "light sky blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1124 { RGB_TO_ULONG(135, 206, 250), "LightSkyBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1125 { RGB_TO_ULONG(70 , 130, 180), "steel blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1126 { RGB_TO_ULONG(70 , 130, 180), "SteelBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1127 { RGB_TO_ULONG(176, 196, 222), "light steel blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1128 { RGB_TO_ULONG(176, 196, 222), "LightSteelBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1129 { RGB_TO_ULONG(173, 216, 230), "light blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1130 { RGB_TO_ULONG(173, 216, 230), "LightBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1131 { RGB_TO_ULONG(176, 224, 230), "powder blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1132 { RGB_TO_ULONG(176, 224, 230), "PowderBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1133 { RGB_TO_ULONG(175, 238, 238), "pale turquoise" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1134 { RGB_TO_ULONG(175, 238, 238), "PaleTurquoise" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1135 { RGB_TO_ULONG(0 , 206, 209), "dark turquoise" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1136 { RGB_TO_ULONG(0 , 206, 209), "DarkTurquoise" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1137 { RGB_TO_ULONG(72 , 209, 204), "medium turquoise" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1138 { RGB_TO_ULONG(72 , 209, 204), "MediumTurquoise" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1139 { RGB_TO_ULONG(64 , 224, 208), "turquoise" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1140 { RGB_TO_ULONG(0 , 255, 255), "cyan" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1141 { RGB_TO_ULONG(224, 255, 255), "light cyan" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1142 { RGB_TO_ULONG(224, 255, 255), "LightCyan" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1143 { RGB_TO_ULONG(95 , 158, 160), "cadet blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1144 { RGB_TO_ULONG(95 , 158, 160), "CadetBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1145 { RGB_TO_ULONG(102, 205, 170), "medium aquamarine" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1146 { RGB_TO_ULONG(102, 205, 170), "MediumAquamarine" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1147 { RGB_TO_ULONG(127, 255, 212), "aquamarine" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1148 { RGB_TO_ULONG(0 , 100, 0 ), "dark green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1149 { RGB_TO_ULONG(0 , 100, 0 ), "DarkGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1150 { RGB_TO_ULONG(85 , 107, 47 ), "dark olive green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1151 { RGB_TO_ULONG(85 , 107, 47 ), "DarkOliveGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1152 { RGB_TO_ULONG(143, 188, 143), "dark sea green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1153 { RGB_TO_ULONG(143, 188, 143), "DarkSeaGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1154 { RGB_TO_ULONG(46 , 139, 87 ), "sea green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1155 { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1156 { RGB_TO_ULONG(60 , 179, 113), "medium sea green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1157 { RGB_TO_ULONG(60 , 179, 113), "MediumSeaGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1158 { RGB_TO_ULONG(32 , 178, 170), "light sea green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1159 { RGB_TO_ULONG(32 , 178, 170), "LightSeaGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1160 { RGB_TO_ULONG(152, 251, 152), "pale green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1161 { RGB_TO_ULONG(152, 251, 152), "PaleGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1162 { RGB_TO_ULONG(0 , 255, 127), "spring green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1163 { RGB_TO_ULONG(0 , 255, 127), "SpringGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1164 { RGB_TO_ULONG(124, 252, 0 ), "lawn green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1165 { RGB_TO_ULONG(124, 252, 0 ), "LawnGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1166 { RGB_TO_ULONG(0 , 255, 0 ), "green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1167 { RGB_TO_ULONG(127, 255, 0 ), "chartreuse" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1168 { RGB_TO_ULONG(0 , 250, 154), "medium spring green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1169 { RGB_TO_ULONG(0 , 250, 154), "MediumSpringGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1170 { RGB_TO_ULONG(173, 255, 47 ), "green yellow" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1171 { RGB_TO_ULONG(173, 255, 47 ), "GreenYellow" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1172 { RGB_TO_ULONG(50 , 205, 50 ), "lime green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1173 { RGB_TO_ULONG(50 , 205, 50 ), "LimeGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1174 { RGB_TO_ULONG(154, 205, 50 ), "yellow green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1175 { RGB_TO_ULONG(154, 205, 50 ), "YellowGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1176 { RGB_TO_ULONG(34 , 139, 34 ), "forest green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1177 { RGB_TO_ULONG(34 , 139, 34 ), "ForestGreen" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1178 { RGB_TO_ULONG(107, 142, 35 ), "olive drab" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1179 { RGB_TO_ULONG(107, 142, 35 ), "OliveDrab" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1180 { RGB_TO_ULONG(189, 183, 107), "dark khaki" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1181 { RGB_TO_ULONG(189, 183, 107), "DarkKhaki" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1182 { RGB_TO_ULONG(240, 230, 140), "khaki" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1183 { RGB_TO_ULONG(238, 232, 170), "pale goldenrod" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1184 { RGB_TO_ULONG(238, 232, 170), "PaleGoldenrod" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1185 { RGB_TO_ULONG(250, 250, 210), "light goldenrod yellow" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1186 { RGB_TO_ULONG(250, 250, 210), "LightGoldenrodYellow" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1187 { RGB_TO_ULONG(255, 255, 224), "light yellow" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1188 { RGB_TO_ULONG(255, 255, 224), "LightYellow" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1189 { RGB_TO_ULONG(255, 255, 0 ), "yellow" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1190 { RGB_TO_ULONG(255, 215, 0 ), "gold" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1191 { RGB_TO_ULONG(238, 221, 130), "light goldenrod" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1192 { RGB_TO_ULONG(238, 221, 130), "LightGoldenrod" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1193 { RGB_TO_ULONG(218, 165, 32 ), "goldenrod" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1194 { RGB_TO_ULONG(184, 134, 11 ), "dark goldenrod" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1195 { RGB_TO_ULONG(184, 134, 11 ), "DarkGoldenrod" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1196 { RGB_TO_ULONG(188, 143, 143), "rosy brown" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1197 { RGB_TO_ULONG(188, 143, 143), "RosyBrown" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1198 { RGB_TO_ULONG(205, 92 , 92 ), "indian red" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1199 { RGB_TO_ULONG(205, 92 , 92 ), "IndianRed" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1200 { RGB_TO_ULONG(139, 69 , 19 ), "saddle brown" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1201 { RGB_TO_ULONG(139, 69 , 19 ), "SaddleBrown" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1202 { RGB_TO_ULONG(160, 82 , 45 ), "sienna" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1203 { RGB_TO_ULONG(205, 133, 63 ), "peru" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1204 { RGB_TO_ULONG(222, 184, 135), "burlywood" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1205 { RGB_TO_ULONG(245, 245, 220), "beige" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1206 { RGB_TO_ULONG(245, 222, 179), "wheat" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1207 { RGB_TO_ULONG(244, 164, 96 ), "sandy brown" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1208 { RGB_TO_ULONG(244, 164, 96 ), "SandyBrown" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1209 { RGB_TO_ULONG(210, 180, 140), "tan" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1210 { RGB_TO_ULONG(210, 105, 30 ), "chocolate" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1211 { RGB_TO_ULONG(178, 34 , 34 ), "firebrick" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1212 { RGB_TO_ULONG(165, 42 , 42 ), "brown" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1213 { RGB_TO_ULONG(233, 150, 122), "dark salmon" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1214 { RGB_TO_ULONG(233, 150, 122), "DarkSalmon" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1215 { RGB_TO_ULONG(250, 128, 114), "salmon" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1216 { RGB_TO_ULONG(255, 160, 122), "light salmon" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1217 { RGB_TO_ULONG(255, 160, 122), "LightSalmon" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1218 { RGB_TO_ULONG(255, 165, 0 ), "orange" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1219 { RGB_TO_ULONG(255, 140, 0 ), "dark orange" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1220 { RGB_TO_ULONG(255, 140, 0 ), "DarkOrange" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1221 { RGB_TO_ULONG(255, 127, 80 ), "coral" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1222 { RGB_TO_ULONG(240, 128, 128), "light coral" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1223 { RGB_TO_ULONG(240, 128, 128), "LightCoral" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1224 { RGB_TO_ULONG(255, 99 , 71 ), "tomato" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1225 { RGB_TO_ULONG(255, 69 , 0 ), "orange red" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1226 { RGB_TO_ULONG(255, 69 , 0 ), "OrangeRed" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1227 { RGB_TO_ULONG(255, 0 , 0 ), "red" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1228 { RGB_TO_ULONG(255, 105, 180), "hot pink" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1229 { RGB_TO_ULONG(255, 105, 180), "HotPink" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1230 { RGB_TO_ULONG(255, 20 , 147), "deep pink" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1231 { RGB_TO_ULONG(255, 20 , 147), "DeepPink" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1232 { RGB_TO_ULONG(255, 192, 203), "pink" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1233 { RGB_TO_ULONG(255, 182, 193), "light pink" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1234 { RGB_TO_ULONG(255, 182, 193), "LightPink" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1235 { RGB_TO_ULONG(219, 112, 147), "pale violet red" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1236 { RGB_TO_ULONG(219, 112, 147), "PaleVioletRed" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1237 { RGB_TO_ULONG(176, 48 , 96 ), "maroon" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1238 { RGB_TO_ULONG(199, 21 , 133), "medium violet red" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1239 { RGB_TO_ULONG(199, 21 , 133), "MediumVioletRed" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1240 { RGB_TO_ULONG(208, 32 , 144), "violet red" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1241 { RGB_TO_ULONG(208, 32 , 144), "VioletRed" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1242 { RGB_TO_ULONG(255, 0 , 255), "magenta" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1243 { RGB_TO_ULONG(238, 130, 238), "violet" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1244 { RGB_TO_ULONG(221, 160, 221), "plum" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1245 { RGB_TO_ULONG(218, 112, 214), "orchid" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1246 { RGB_TO_ULONG(186, 85 , 211), "medium orchid" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1247 { RGB_TO_ULONG(186, 85 , 211), "MediumOrchid" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1248 { RGB_TO_ULONG(153, 50 , 204), "dark orchid" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1249 { RGB_TO_ULONG(153, 50 , 204), "DarkOrchid" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1250 { RGB_TO_ULONG(148, 0 , 211), "dark violet" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1251 { RGB_TO_ULONG(148, 0 , 211), "DarkViolet" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1252 { RGB_TO_ULONG(138, 43 , 226), "blue violet" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1253 { RGB_TO_ULONG(138, 43 , 226), "BlueViolet" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1254 { RGB_TO_ULONG(160, 32 , 240), "purple" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1255 { RGB_TO_ULONG(147, 112, 219), "medium purple" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1256 { RGB_TO_ULONG(147, 112, 219), "MediumPurple" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1257 { RGB_TO_ULONG(216, 191, 216), "thistle" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1258 { RGB_TO_ULONG(255, 250, 250), "snow1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1259 { RGB_TO_ULONG(238, 233, 233), "snow2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1260 { RGB_TO_ULONG(205, 201, 201), "snow3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1261 { RGB_TO_ULONG(139, 137, 137), "snow4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1262 { RGB_TO_ULONG(255, 245, 238), "seashell1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1263 { RGB_TO_ULONG(238, 229, 222), "seashell2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1264 { RGB_TO_ULONG(205, 197, 191), "seashell3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1265 { RGB_TO_ULONG(139, 134, 130), "seashell4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1266 { RGB_TO_ULONG(255, 239, 219), "AntiqueWhite1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1267 { RGB_TO_ULONG(238, 223, 204), "AntiqueWhite2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1268 { RGB_TO_ULONG(205, 192, 176), "AntiqueWhite3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1269 { RGB_TO_ULONG(139, 131, 120), "AntiqueWhite4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1270 { RGB_TO_ULONG(255, 228, 196), "bisque1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1271 { RGB_TO_ULONG(238, 213, 183), "bisque2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1272 { RGB_TO_ULONG(205, 183, 158), "bisque3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1273 { RGB_TO_ULONG(139, 125, 107), "bisque4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1274 { RGB_TO_ULONG(255, 218, 185), "PeachPuff1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1275 { RGB_TO_ULONG(238, 203, 173), "PeachPuff2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1276 { RGB_TO_ULONG(205, 175, 149), "PeachPuff3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1277 { RGB_TO_ULONG(139, 119, 101), "PeachPuff4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1278 { RGB_TO_ULONG(255, 222, 173), "NavajoWhite1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1279 { RGB_TO_ULONG(238, 207, 161), "NavajoWhite2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1280 { RGB_TO_ULONG(205, 179, 139), "NavajoWhite3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1281 { RGB_TO_ULONG(139, 121, 94), "NavajoWhite4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1282 { RGB_TO_ULONG(255, 250, 205), "LemonChiffon1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1283 { RGB_TO_ULONG(238, 233, 191), "LemonChiffon2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1284 { RGB_TO_ULONG(205, 201, 165), "LemonChiffon3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1285 { RGB_TO_ULONG(139, 137, 112), "LemonChiffon4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1286 { RGB_TO_ULONG(255, 248, 220), "cornsilk1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1287 { RGB_TO_ULONG(238, 232, 205), "cornsilk2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1288 { RGB_TO_ULONG(205, 200, 177), "cornsilk3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1289 { RGB_TO_ULONG(139, 136, 120), "cornsilk4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1290 { RGB_TO_ULONG(255, 255, 240), "ivory1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1291 { RGB_TO_ULONG(238, 238, 224), "ivory2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1292 { RGB_TO_ULONG(205, 205, 193), "ivory3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1293 { RGB_TO_ULONG(139, 139, 131), "ivory4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1294 { RGB_TO_ULONG(240, 255, 240), "honeydew1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1295 { RGB_TO_ULONG(224, 238, 224), "honeydew2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1296 { RGB_TO_ULONG(193, 205, 193), "honeydew3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1297 { RGB_TO_ULONG(131, 139, 131), "honeydew4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1298 { RGB_TO_ULONG(255, 240, 245), "LavenderBlush1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1299 { RGB_TO_ULONG(238, 224, 229), "LavenderBlush2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1300 { RGB_TO_ULONG(205, 193, 197), "LavenderBlush3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1301 { RGB_TO_ULONG(139, 131, 134), "LavenderBlush4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1302 { RGB_TO_ULONG(255, 228, 225), "MistyRose1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1303 { RGB_TO_ULONG(238, 213, 210), "MistyRose2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1304 { RGB_TO_ULONG(205, 183, 181), "MistyRose3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1305 { RGB_TO_ULONG(139, 125, 123), "MistyRose4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1306 { RGB_TO_ULONG(240, 255, 255), "azure1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1307 { RGB_TO_ULONG(224, 238, 238), "azure2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1308 { RGB_TO_ULONG(193, 205, 205), "azure3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1309 { RGB_TO_ULONG(131, 139, 139), "azure4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1310 { RGB_TO_ULONG(131, 111, 255), "SlateBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1311 { RGB_TO_ULONG(122, 103, 238), "SlateBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1312 { RGB_TO_ULONG(105, 89 , 205), "SlateBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1313 { RGB_TO_ULONG(71 , 60 , 139), "SlateBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1314 { RGB_TO_ULONG(72 , 118, 255), "RoyalBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1315 { RGB_TO_ULONG(67 , 110, 238), "RoyalBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1316 { RGB_TO_ULONG(58 , 95 , 205), "RoyalBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1317 { RGB_TO_ULONG(39 , 64 , 139), "RoyalBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1318 { RGB_TO_ULONG(0 , 0 , 255), "blue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1319 { RGB_TO_ULONG(0 , 0 , 238), "blue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1320 { RGB_TO_ULONG(0 , 0 , 205), "blue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1321 { RGB_TO_ULONG(0 , 0 , 139), "blue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1322 { RGB_TO_ULONG(30 , 144, 255), "DodgerBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1323 { RGB_TO_ULONG(28 , 134, 238), "DodgerBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1324 { RGB_TO_ULONG(24 , 116, 205), "DodgerBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1325 { RGB_TO_ULONG(16 , 78 , 139), "DodgerBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1326 { RGB_TO_ULONG(99 , 184, 255), "SteelBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1327 { RGB_TO_ULONG(92 , 172, 238), "SteelBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1328 { RGB_TO_ULONG(79 , 148, 205), "SteelBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1329 { RGB_TO_ULONG(54 , 100, 139), "SteelBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1330 { RGB_TO_ULONG(0 , 191, 255), "DeepSkyBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1331 { RGB_TO_ULONG(0 , 178, 238), "DeepSkyBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1332 { RGB_TO_ULONG(0 , 154, 205), "DeepSkyBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1333 { RGB_TO_ULONG(0 , 104, 139), "DeepSkyBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1334 { RGB_TO_ULONG(135, 206, 255), "SkyBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1335 { RGB_TO_ULONG(126, 192, 238), "SkyBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1336 { RGB_TO_ULONG(108, 166, 205), "SkyBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1337 { RGB_TO_ULONG(74 , 112, 139), "SkyBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1338 { RGB_TO_ULONG(176, 226, 255), "LightSkyBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1339 { RGB_TO_ULONG(164, 211, 238), "LightSkyBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1340 { RGB_TO_ULONG(141, 182, 205), "LightSkyBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1341 { RGB_TO_ULONG(96 , 123, 139), "LightSkyBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1342 { RGB_TO_ULONG(198, 226, 255), "SlateGray1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1343 { RGB_TO_ULONG(185, 211, 238), "SlateGray2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1344 { RGB_TO_ULONG(159, 182, 205), "SlateGray3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1345 { RGB_TO_ULONG(108, 123, 139), "SlateGray4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1346 { RGB_TO_ULONG(202, 225, 255), "LightSteelBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1347 { RGB_TO_ULONG(188, 210, 238), "LightSteelBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1348 { RGB_TO_ULONG(162, 181, 205), "LightSteelBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1349 { RGB_TO_ULONG(110, 123, 139), "LightSteelBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1350 { RGB_TO_ULONG(191, 239, 255), "LightBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1351 { RGB_TO_ULONG(178, 223, 238), "LightBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1352 { RGB_TO_ULONG(154, 192, 205), "LightBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1353 { RGB_TO_ULONG(104, 131, 139), "LightBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1354 { RGB_TO_ULONG(224, 255, 255), "LightCyan1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1355 { RGB_TO_ULONG(209, 238, 238), "LightCyan2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1356 { RGB_TO_ULONG(180, 205, 205), "LightCyan3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1357 { RGB_TO_ULONG(122, 139, 139), "LightCyan4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1358 { RGB_TO_ULONG(187, 255, 255), "PaleTurquoise1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1359 { RGB_TO_ULONG(174, 238, 238), "PaleTurquoise2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1360 { RGB_TO_ULONG(150, 205, 205), "PaleTurquoise3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1361 { RGB_TO_ULONG(102, 139, 139), "PaleTurquoise4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1362 { RGB_TO_ULONG(152, 245, 255), "CadetBlue1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1363 { RGB_TO_ULONG(142, 229, 238), "CadetBlue2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1364 { RGB_TO_ULONG(122, 197, 205), "CadetBlue3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1365 { RGB_TO_ULONG(83 , 134, 139), "CadetBlue4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1366 { RGB_TO_ULONG(0 , 245, 255), "turquoise1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1367 { RGB_TO_ULONG(0 , 229, 238), "turquoise2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1368 { RGB_TO_ULONG(0 , 197, 205), "turquoise3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1369 { RGB_TO_ULONG(0 , 134, 139), "turquoise4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1370 { RGB_TO_ULONG(0 , 255, 255), "cyan1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1371 { RGB_TO_ULONG(0 , 238, 238), "cyan2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1372 { RGB_TO_ULONG(0 , 205, 205), "cyan3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1373 { RGB_TO_ULONG(0 , 139, 139), "cyan4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1374 { RGB_TO_ULONG(151, 255, 255), "DarkSlateGray1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1375 { RGB_TO_ULONG(141, 238, 238), "DarkSlateGray2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1376 { RGB_TO_ULONG(121, 205, 205), "DarkSlateGray3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1377 { RGB_TO_ULONG(82 , 139, 139), "DarkSlateGray4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1378 { RGB_TO_ULONG(127, 255, 212), "aquamarine1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1379 { RGB_TO_ULONG(118, 238, 198), "aquamarine2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1380 { RGB_TO_ULONG(102, 205, 170), "aquamarine3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1381 { RGB_TO_ULONG(69 , 139, 116), "aquamarine4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1382 { RGB_TO_ULONG(193, 255, 193), "DarkSeaGreen1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1383 { RGB_TO_ULONG(180, 238, 180), "DarkSeaGreen2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1384 { RGB_TO_ULONG(155, 205, 155), "DarkSeaGreen3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1385 { RGB_TO_ULONG(105, 139, 105), "DarkSeaGreen4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1386 { RGB_TO_ULONG(84 , 255, 159), "SeaGreen1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1387 { RGB_TO_ULONG(78 , 238, 148), "SeaGreen2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1388 { RGB_TO_ULONG(67 , 205, 128), "SeaGreen3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1389 { RGB_TO_ULONG(46 , 139, 87 ), "SeaGreen4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1390 { RGB_TO_ULONG(154, 255, 154), "PaleGreen1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1391 { RGB_TO_ULONG(144, 238, 144), "PaleGreen2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1392 { RGB_TO_ULONG(124, 205, 124), "PaleGreen3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1393 { RGB_TO_ULONG(84 , 139, 84 ), "PaleGreen4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1394 { RGB_TO_ULONG(0 , 255, 127), "SpringGreen1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1395 { RGB_TO_ULONG(0 , 238, 118), "SpringGreen2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1396 { RGB_TO_ULONG(0 , 205, 102), "SpringGreen3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1397 { RGB_TO_ULONG(0 , 139, 69 ), "SpringGreen4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1398 { RGB_TO_ULONG(0 , 255, 0 ), "green1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1399 { RGB_TO_ULONG(0 , 238, 0 ), "green2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1400 { RGB_TO_ULONG(0 , 205, 0 ), "green3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1401 { RGB_TO_ULONG(0 , 139, 0 ), "green4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1402 { RGB_TO_ULONG(127, 255, 0 ), "chartreuse1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1403 { RGB_TO_ULONG(118, 238, 0 ), "chartreuse2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1404 { RGB_TO_ULONG(102, 205, 0 ), "chartreuse3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1405 { RGB_TO_ULONG(69 , 139, 0 ), "chartreuse4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1406 { RGB_TO_ULONG(192, 255, 62 ), "OliveDrab1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1407 { RGB_TO_ULONG(179, 238, 58 ), "OliveDrab2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1408 { RGB_TO_ULONG(154, 205, 50 ), "OliveDrab3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1409 { RGB_TO_ULONG(105, 139, 34 ), "OliveDrab4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1410 { RGB_TO_ULONG(202, 255, 112), "DarkOliveGreen1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1411 { RGB_TO_ULONG(188, 238, 104), "DarkOliveGreen2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1412 { RGB_TO_ULONG(162, 205, 90 ), "DarkOliveGreen3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1413 { RGB_TO_ULONG(110, 139, 61 ), "DarkOliveGreen4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1414 { RGB_TO_ULONG(255, 246, 143), "khaki1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1415 { RGB_TO_ULONG(238, 230, 133), "khaki2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1416 { RGB_TO_ULONG(205, 198, 115), "khaki3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1417 { RGB_TO_ULONG(139, 134, 78 ), "khaki4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1418 { RGB_TO_ULONG(255, 236, 139), "LightGoldenrod1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1419 { RGB_TO_ULONG(238, 220, 130), "LightGoldenrod2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1420 { RGB_TO_ULONG(205, 190, 112), "LightGoldenrod3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1421 { RGB_TO_ULONG(139, 129, 76 ), "LightGoldenrod4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1422 { RGB_TO_ULONG(255, 255, 224), "LightYellow1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1423 { RGB_TO_ULONG(238, 238, 209), "LightYellow2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1424 { RGB_TO_ULONG(205, 205, 180), "LightYellow3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1425 { RGB_TO_ULONG(139, 139, 122), "LightYellow4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1426 { RGB_TO_ULONG(255, 255, 0 ), "yellow1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1427 { RGB_TO_ULONG(238, 238, 0 ), "yellow2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1428 { RGB_TO_ULONG(205, 205, 0 ), "yellow3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1429 { RGB_TO_ULONG(139, 139, 0 ), "yellow4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1430 { RGB_TO_ULONG(255, 215, 0 ), "gold1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1431 { RGB_TO_ULONG(238, 201, 0 ), "gold2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1432 { RGB_TO_ULONG(205, 173, 0 ), "gold3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1433 { RGB_TO_ULONG(139, 117, 0 ), "gold4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1434 { RGB_TO_ULONG(255, 193, 37 ), "goldenrod1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1435 { RGB_TO_ULONG(238, 180, 34 ), "goldenrod2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1436 { RGB_TO_ULONG(205, 155, 29 ), "goldenrod3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1437 { RGB_TO_ULONG(139, 105, 20 ), "goldenrod4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1438 { RGB_TO_ULONG(255, 185, 15 ), "DarkGoldenrod1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1439 { RGB_TO_ULONG(238, 173, 14 ), "DarkGoldenrod2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1440 { RGB_TO_ULONG(205, 149, 12 ), "DarkGoldenrod3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1441 { RGB_TO_ULONG(139, 101, 8 ), "DarkGoldenrod4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1442 { RGB_TO_ULONG(255, 193, 193), "RosyBrown1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1443 { RGB_TO_ULONG(238, 180, 180), "RosyBrown2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1444 { RGB_TO_ULONG(205, 155, 155), "RosyBrown3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1445 { RGB_TO_ULONG(139, 105, 105), "RosyBrown4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1446 { RGB_TO_ULONG(255, 106, 106), "IndianRed1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1447 { RGB_TO_ULONG(238, 99 , 99 ), "IndianRed2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1448 { RGB_TO_ULONG(205, 85 , 85 ), "IndianRed3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1449 { RGB_TO_ULONG(139, 58 , 58 ), "IndianRed4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1450 { RGB_TO_ULONG(255, 130, 71 ), "sienna1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1451 { RGB_TO_ULONG(238, 121, 66 ), "sienna2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1452 { RGB_TO_ULONG(205, 104, 57 ), "sienna3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1453 { RGB_TO_ULONG(139, 71 , 38 ), "sienna4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1454 { RGB_TO_ULONG(255, 211, 155), "burlywood1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1455 { RGB_TO_ULONG(238, 197, 145), "burlywood2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1456 { RGB_TO_ULONG(205, 170, 125), "burlywood3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1457 { RGB_TO_ULONG(139, 115, 85 ), "burlywood4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1458 { RGB_TO_ULONG(255, 231, 186), "wheat1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1459 { RGB_TO_ULONG(238, 216, 174), "wheat2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1460 { RGB_TO_ULONG(205, 186, 150), "wheat3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1461 { RGB_TO_ULONG(139, 126, 102), "wheat4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1462 { RGB_TO_ULONG(255, 165, 79 ), "tan1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1463 { RGB_TO_ULONG(238, 154, 73 ), "tan2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1464 { RGB_TO_ULONG(205, 133, 63 ), "tan3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1465 { RGB_TO_ULONG(139, 90 , 43 ), "tan4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1466 { RGB_TO_ULONG(255, 127, 36 ), "chocolate1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1467 { RGB_TO_ULONG(238, 118, 33 ), "chocolate2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1468 { RGB_TO_ULONG(205, 102, 29 ), "chocolate3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1469 { RGB_TO_ULONG(139, 69 , 19 ), "chocolate4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1470 { RGB_TO_ULONG(255, 48 , 48 ), "firebrick1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1471 { RGB_TO_ULONG(238, 44 , 44 ), "firebrick2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1472 { RGB_TO_ULONG(205, 38 , 38 ), "firebrick3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1473 { RGB_TO_ULONG(139, 26 , 26 ), "firebrick4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1474 { RGB_TO_ULONG(255, 64 , 64 ), "brown1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1475 { RGB_TO_ULONG(238, 59 , 59 ), "brown2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1476 { RGB_TO_ULONG(205, 51 , 51 ), "brown3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1477 { RGB_TO_ULONG(139, 35 , 35 ), "brown4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1478 { RGB_TO_ULONG(255, 140, 105), "salmon1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1479 { RGB_TO_ULONG(238, 130, 98 ), "salmon2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1480 { RGB_TO_ULONG(205, 112, 84 ), "salmon3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1481 { RGB_TO_ULONG(139, 76 , 57 ), "salmon4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1482 { RGB_TO_ULONG(255, 160, 122), "LightSalmon1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1483 { RGB_TO_ULONG(238, 149, 114), "LightSalmon2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1484 { RGB_TO_ULONG(205, 129, 98 ), "LightSalmon3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1485 { RGB_TO_ULONG(139, 87 , 66 ), "LightSalmon4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1486 { RGB_TO_ULONG(255, 165, 0 ), "orange1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1487 { RGB_TO_ULONG(238, 154, 0 ), "orange2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1488 { RGB_TO_ULONG(205, 133, 0 ), "orange3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1489 { RGB_TO_ULONG(139, 90 , 0 ), "orange4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1490 { RGB_TO_ULONG(255, 127, 0 ), "DarkOrange1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1491 { RGB_TO_ULONG(238, 118, 0 ), "DarkOrange2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1492 { RGB_TO_ULONG(205, 102, 0 ), "DarkOrange3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1493 { RGB_TO_ULONG(139, 69 , 0 ), "DarkOrange4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1494 { RGB_TO_ULONG(255, 114, 86 ), "coral1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1495 { RGB_TO_ULONG(238, 106, 80 ), "coral2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1496 { RGB_TO_ULONG(205, 91 , 69 ), "coral3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1497 { RGB_TO_ULONG(139, 62 , 47 ), "coral4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1498 { RGB_TO_ULONG(255, 99 , 71 ), "tomato1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1499 { RGB_TO_ULONG(238, 92 , 66 ), "tomato2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1500 { RGB_TO_ULONG(205, 79 , 57 ), "tomato3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1501 { RGB_TO_ULONG(139, 54 , 38 ), "tomato4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1502 { RGB_TO_ULONG(255, 69 , 0 ), "OrangeRed1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1503 { RGB_TO_ULONG(238, 64 , 0 ), "OrangeRed2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1504 { RGB_TO_ULONG(205, 55 , 0 ), "OrangeRed3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1505 { RGB_TO_ULONG(139, 37 , 0 ), "OrangeRed4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1506 { RGB_TO_ULONG(255, 0 , 0 ), "red1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1507 { RGB_TO_ULONG(238, 0 , 0 ), "red2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1508 { RGB_TO_ULONG(205, 0 , 0 ), "red3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1509 { RGB_TO_ULONG(139, 0 , 0 ), "red4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1510 { RGB_TO_ULONG(255, 20 , 147), "DeepPink1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1511 { RGB_TO_ULONG(238, 18 , 137), "DeepPink2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1512 { RGB_TO_ULONG(205, 16 , 118), "DeepPink3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1513 { RGB_TO_ULONG(139, 10 , 80 ), "DeepPink4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1514 { RGB_TO_ULONG(255, 110, 180), "HotPink1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1515 { RGB_TO_ULONG(238, 106, 167), "HotPink2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1516 { RGB_TO_ULONG(205, 96 , 144), "HotPink3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1517 { RGB_TO_ULONG(139, 58 , 98 ), "HotPink4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1518 { RGB_TO_ULONG(255, 181, 197), "pink1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1519 { RGB_TO_ULONG(238, 169, 184), "pink2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1520 { RGB_TO_ULONG(205, 145, 158), "pink3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1521 { RGB_TO_ULONG(139, 99 , 108), "pink4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1522 { RGB_TO_ULONG(255, 174, 185), "LightPink1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1523 { RGB_TO_ULONG(238, 162, 173), "LightPink2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1524 { RGB_TO_ULONG(205, 140, 149), "LightPink3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1525 { RGB_TO_ULONG(139, 95 , 101), "LightPink4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1526 { RGB_TO_ULONG(255, 130, 171), "PaleVioletRed1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1527 { RGB_TO_ULONG(238, 121, 159), "PaleVioletRed2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1528 { RGB_TO_ULONG(205, 104, 137), "PaleVioletRed3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1529 { RGB_TO_ULONG(139, 71 , 93 ), "PaleVioletRed4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1530 { RGB_TO_ULONG(255, 52 , 179), "maroon1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1531 { RGB_TO_ULONG(238, 48 , 167), "maroon2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1532 { RGB_TO_ULONG(205, 41 , 144), "maroon3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1533 { RGB_TO_ULONG(139, 28 , 98 ), "maroon4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1534 { RGB_TO_ULONG(255, 62 , 150), "VioletRed1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1535 { RGB_TO_ULONG(238, 58 , 140), "VioletRed2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1536 { RGB_TO_ULONG(205, 50 , 120), "VioletRed3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1537 { RGB_TO_ULONG(139, 34 , 82 ), "VioletRed4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1538 { RGB_TO_ULONG(255, 0 , 255), "magenta1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1539 { RGB_TO_ULONG(238, 0 , 238), "magenta2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1540 { RGB_TO_ULONG(205, 0 , 205), "magenta3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1541 { RGB_TO_ULONG(139, 0 , 139), "magenta4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1542 { RGB_TO_ULONG(255, 131, 250), "orchid1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1543 { RGB_TO_ULONG(238, 122, 233), "orchid2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1544 { RGB_TO_ULONG(205, 105, 201), "orchid3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1545 { RGB_TO_ULONG(139, 71 , 137), "orchid4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1546 { RGB_TO_ULONG(255, 187, 255), "plum1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1547 { RGB_TO_ULONG(238, 174, 238), "plum2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1548 { RGB_TO_ULONG(205, 150, 205), "plum3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1549 { RGB_TO_ULONG(139, 102, 139), "plum4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1550 { RGB_TO_ULONG(224, 102, 255), "MediumOrchid1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1551 { RGB_TO_ULONG(209, 95 , 238), "MediumOrchid2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1552 { RGB_TO_ULONG(180, 82 , 205), "MediumOrchid3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1553 { RGB_TO_ULONG(122, 55 , 139), "MediumOrchid4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1554 { RGB_TO_ULONG(191, 62 , 255), "DarkOrchid1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1555 { RGB_TO_ULONG(178, 58 , 238), "DarkOrchid2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1556 { RGB_TO_ULONG(154, 50 , 205), "DarkOrchid3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1557 { RGB_TO_ULONG(104, 34 , 139), "DarkOrchid4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1558 { RGB_TO_ULONG(155, 48 , 255), "purple1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1559 { RGB_TO_ULONG(145, 44 , 238), "purple2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1560 { RGB_TO_ULONG(125, 38 , 205), "purple3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1561 { RGB_TO_ULONG(85 , 26 , 139), "purple4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1562 { RGB_TO_ULONG(171, 130, 255), "MediumPurple1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1563 { RGB_TO_ULONG(159, 121, 238), "MediumPurple2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1564 { RGB_TO_ULONG(137, 104, 205), "MediumPurple3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1565 { RGB_TO_ULONG(93 , 71 , 139), "MediumPurple4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1566 { RGB_TO_ULONG(255, 225, 255), "thistle1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1567 { RGB_TO_ULONG(238, 210, 238), "thistle2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1568 { RGB_TO_ULONG(205, 181, 205), "thistle3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1569 { RGB_TO_ULONG(139, 123, 139), "thistle4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1570 { RGB_TO_ULONG(0 , 0 , 0 ), "gray0" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1571 { RGB_TO_ULONG(0 , 0 , 0 ), "grey0" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1572 { RGB_TO_ULONG(3 , 3 , 3 ), "gray1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1573 { RGB_TO_ULONG(3 , 3 , 3 ), "grey1" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1574 { RGB_TO_ULONG(5 , 5 , 5 ), "gray2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1575 { RGB_TO_ULONG(5 , 5 , 5 ), "grey2" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1576 { RGB_TO_ULONG(8 , 8 , 8 ), "gray3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1577 { RGB_TO_ULONG(8 , 8 , 8 ), "grey3" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1578 { RGB_TO_ULONG(10 , 10 , 10 ), "gray4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1579 { RGB_TO_ULONG(10 , 10 , 10 ), "grey4" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1580 { RGB_TO_ULONG(13 , 13 , 13 ), "gray5" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1581 { RGB_TO_ULONG(13 , 13 , 13 ), "grey5" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1582 { RGB_TO_ULONG(15 , 15 , 15 ), "gray6" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1583 { RGB_TO_ULONG(15 , 15 , 15 ), "grey6" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1584 { RGB_TO_ULONG(18 , 18 , 18 ), "gray7" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1585 { RGB_TO_ULONG(18 , 18 , 18 ), "grey7" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1586 { RGB_TO_ULONG(20 , 20 , 20 ), "gray8" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1587 { RGB_TO_ULONG(20 , 20 , 20 ), "grey8" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1588 { RGB_TO_ULONG(23 , 23 , 23 ), "gray9" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1589 { RGB_TO_ULONG(23 , 23 , 23 ), "grey9" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1590 { RGB_TO_ULONG(26 , 26 , 26 ), "gray10" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1591 { RGB_TO_ULONG(26 , 26 , 26 ), "grey10" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1592 { RGB_TO_ULONG(28 , 28 , 28 ), "gray11" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1593 { RGB_TO_ULONG(28 , 28 , 28 ), "grey11" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1594 { RGB_TO_ULONG(31 , 31 , 31 ), "gray12" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1595 { RGB_TO_ULONG(31 , 31 , 31 ), "grey12" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1596 { RGB_TO_ULONG(33 , 33 , 33 ), "gray13" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1597 { RGB_TO_ULONG(33 , 33 , 33 ), "grey13" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1598 { RGB_TO_ULONG(36 , 36 , 36 ), "gray14" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1599 { RGB_TO_ULONG(36 , 36 , 36 ), "grey14" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1600 { RGB_TO_ULONG(38 , 38 , 38 ), "gray15" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1601 { RGB_TO_ULONG(38 , 38 , 38 ), "grey15" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1602 { RGB_TO_ULONG(41 , 41 , 41 ), "gray16" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1603 { RGB_TO_ULONG(41 , 41 , 41 ), "grey16" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1604 { RGB_TO_ULONG(43 , 43 , 43 ), "gray17" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1605 { RGB_TO_ULONG(43 , 43 , 43 ), "grey17" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1606 { RGB_TO_ULONG(46 , 46 , 46 ), "gray18" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1607 { RGB_TO_ULONG(46 , 46 , 46 ), "grey18" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1608 { RGB_TO_ULONG(48 , 48 , 48 ), "gray19" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1609 { RGB_TO_ULONG(48 , 48 , 48 ), "grey19" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1610 { RGB_TO_ULONG(51 , 51 , 51 ), "gray20" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1611 { RGB_TO_ULONG(51 , 51 , 51 ), "grey20" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1612 { RGB_TO_ULONG(54 , 54 , 54 ), "gray21" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1613 { RGB_TO_ULONG(54 , 54 , 54 ), "grey21" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1614 { RGB_TO_ULONG(56 , 56 , 56 ), "gray22" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1615 { RGB_TO_ULONG(56 , 56 , 56 ), "grey22" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1616 { RGB_TO_ULONG(59 , 59 , 59 ), "gray23" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1617 { RGB_TO_ULONG(59 , 59 , 59 ), "grey23" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1618 { RGB_TO_ULONG(61 , 61 , 61 ), "gray24" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1619 { RGB_TO_ULONG(61 , 61 , 61 ), "grey24" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1620 { RGB_TO_ULONG(64 , 64 , 64 ), "gray25" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1621 { RGB_TO_ULONG(64 , 64 , 64 ), "grey25" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1622 { RGB_TO_ULONG(66 , 66 , 66 ), "gray26" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1623 { RGB_TO_ULONG(66 , 66 , 66 ), "grey26" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1624 { RGB_TO_ULONG(69 , 69 , 69 ), "gray27" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1625 { RGB_TO_ULONG(69 , 69 , 69 ), "grey27" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1626 { RGB_TO_ULONG(71 , 71 , 71 ), "gray28" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1627 { RGB_TO_ULONG(71 , 71 , 71 ), "grey28" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1628 { RGB_TO_ULONG(74 , 74 , 74 ), "gray29" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1629 { RGB_TO_ULONG(74 , 74 , 74 ), "grey29" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1630 { RGB_TO_ULONG(77 , 77 , 77 ), "gray30" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1631 { RGB_TO_ULONG(77 , 77 , 77 ), "grey30" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1632 { RGB_TO_ULONG(79 , 79 , 79 ), "gray31" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1633 { RGB_TO_ULONG(79 , 79 , 79 ), "grey31" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1634 { RGB_TO_ULONG(82 , 82 , 82 ), "gray32" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1635 { RGB_TO_ULONG(82 , 82 , 82 ), "grey32" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1636 { RGB_TO_ULONG(84 , 84 , 84 ), "gray33" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1637 { RGB_TO_ULONG(84 , 84 , 84 ), "grey33" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1638 { RGB_TO_ULONG(87 , 87 , 87 ), "gray34" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1639 { RGB_TO_ULONG(87 , 87 , 87 ), "grey34" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1640 { RGB_TO_ULONG(89 , 89 , 89 ), "gray35" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1641 { RGB_TO_ULONG(89 , 89 , 89 ), "grey35" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1642 { RGB_TO_ULONG(92 , 92 , 92 ), "gray36" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1643 { RGB_TO_ULONG(92 , 92 , 92 ), "grey36" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1644 { RGB_TO_ULONG(94 , 94 , 94 ), "gray37" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1645 { RGB_TO_ULONG(94 , 94 , 94 ), "grey37" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1646 { RGB_TO_ULONG(97 , 97 , 97 ), "gray38" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1647 { RGB_TO_ULONG(97 , 97 , 97 ), "grey38" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1648 { RGB_TO_ULONG(99 , 99 , 99 ), "gray39" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1649 { RGB_TO_ULONG(99 , 99 , 99 ), "grey39" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1650 { RGB_TO_ULONG(102, 102, 102), "gray40" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1651 { RGB_TO_ULONG(102, 102, 102), "grey40" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1652 { RGB_TO_ULONG(105, 105, 105), "gray41" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1653 { RGB_TO_ULONG(105, 105, 105), "grey41" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1654 { RGB_TO_ULONG(107, 107, 107), "gray42" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1655 { RGB_TO_ULONG(107, 107, 107), "grey42" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1656 { RGB_TO_ULONG(110, 110, 110), "gray43" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1657 { RGB_TO_ULONG(110, 110, 110), "grey43" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1658 { RGB_TO_ULONG(112, 112, 112), "gray44" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1659 { RGB_TO_ULONG(112, 112, 112), "grey44" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1660 { RGB_TO_ULONG(115, 115, 115), "gray45" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1661 { RGB_TO_ULONG(115, 115, 115), "grey45" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1662 { RGB_TO_ULONG(117, 117, 117), "gray46" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1663 { RGB_TO_ULONG(117, 117, 117), "grey46" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1664 { RGB_TO_ULONG(120, 120, 120), "gray47" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1665 { RGB_TO_ULONG(120, 120, 120), "grey47" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1666 { RGB_TO_ULONG(122, 122, 122), "gray48" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1667 { RGB_TO_ULONG(122, 122, 122), "grey48" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1668 { RGB_TO_ULONG(125, 125, 125), "gray49" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1669 { RGB_TO_ULONG(125, 125, 125), "grey49" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1670 { RGB_TO_ULONG(127, 127, 127), "gray50" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1671 { RGB_TO_ULONG(127, 127, 127), "grey50" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1672 { RGB_TO_ULONG(130, 130, 130), "gray51" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1673 { RGB_TO_ULONG(130, 130, 130), "grey51" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1674 { RGB_TO_ULONG(133, 133, 133), "gray52" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1675 { RGB_TO_ULONG(133, 133, 133), "grey52" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1676 { RGB_TO_ULONG(135, 135, 135), "gray53" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1677 { RGB_TO_ULONG(135, 135, 135), "grey53" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1678 { RGB_TO_ULONG(138, 138, 138), "gray54" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1679 { RGB_TO_ULONG(138, 138, 138), "grey54" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1680 { RGB_TO_ULONG(140, 140, 140), "gray55" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1681 { RGB_TO_ULONG(140, 140, 140), "grey55" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1682 { RGB_TO_ULONG(143, 143, 143), "gray56" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1683 { RGB_TO_ULONG(143, 143, 143), "grey56" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1684 { RGB_TO_ULONG(145, 145, 145), "gray57" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1685 { RGB_TO_ULONG(145, 145, 145), "grey57" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1686 { RGB_TO_ULONG(148, 148, 148), "gray58" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1687 { RGB_TO_ULONG(148, 148, 148), "grey58" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1688 { RGB_TO_ULONG(150, 150, 150), "gray59" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1689 { RGB_TO_ULONG(150, 150, 150), "grey59" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1690 { RGB_TO_ULONG(153, 153, 153), "gray60" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1691 { RGB_TO_ULONG(153, 153, 153), "grey60" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1692 { RGB_TO_ULONG(156, 156, 156), "gray61" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1693 { RGB_TO_ULONG(156, 156, 156), "grey61" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1694 { RGB_TO_ULONG(158, 158, 158), "gray62" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1695 { RGB_TO_ULONG(158, 158, 158), "grey62" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1696 { RGB_TO_ULONG(161, 161, 161), "gray63" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1697 { RGB_TO_ULONG(161, 161, 161), "grey63" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1698 { RGB_TO_ULONG(163, 163, 163), "gray64" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1699 { RGB_TO_ULONG(163, 163, 163), "grey64" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1700 { RGB_TO_ULONG(166, 166, 166), "gray65" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1701 { RGB_TO_ULONG(166, 166, 166), "grey65" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1702 { RGB_TO_ULONG(168, 168, 168), "gray66" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1703 { RGB_TO_ULONG(168, 168, 168), "grey66" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1704 { RGB_TO_ULONG(171, 171, 171), "gray67" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1705 { RGB_TO_ULONG(171, 171, 171), "grey67" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1706 { RGB_TO_ULONG(173, 173, 173), "gray68" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1707 { RGB_TO_ULONG(173, 173, 173), "grey68" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1708 { RGB_TO_ULONG(176, 176, 176), "gray69" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1709 { RGB_TO_ULONG(176, 176, 176), "grey69" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1710 { RGB_TO_ULONG(179, 179, 179), "gray70" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1711 { RGB_TO_ULONG(179, 179, 179), "grey70" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1712 { RGB_TO_ULONG(181, 181, 181), "gray71" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1713 { RGB_TO_ULONG(181, 181, 181), "grey71" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1714 { RGB_TO_ULONG(184, 184, 184), "gray72" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1715 { RGB_TO_ULONG(184, 184, 184), "grey72" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1716 { RGB_TO_ULONG(186, 186, 186), "gray73" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1717 { RGB_TO_ULONG(186, 186, 186), "grey73" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1718 { RGB_TO_ULONG(189, 189, 189), "gray74" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1719 { RGB_TO_ULONG(189, 189, 189), "grey74" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1720 { RGB_TO_ULONG(191, 191, 191), "gray75" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1721 { RGB_TO_ULONG(191, 191, 191), "grey75" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1722 { RGB_TO_ULONG(194, 194, 194), "gray76" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1723 { RGB_TO_ULONG(194, 194, 194), "grey76" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1724 { RGB_TO_ULONG(196, 196, 196), "gray77" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1725 { RGB_TO_ULONG(196, 196, 196), "grey77" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1726 { RGB_TO_ULONG(199, 199, 199), "gray78" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1727 { RGB_TO_ULONG(199, 199, 199), "grey78" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1728 { RGB_TO_ULONG(201, 201, 201), "gray79" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1729 { RGB_TO_ULONG(201, 201, 201), "grey79" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1730 { RGB_TO_ULONG(204, 204, 204), "gray80" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1731 { RGB_TO_ULONG(204, 204, 204), "grey80" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1732 { RGB_TO_ULONG(207, 207, 207), "gray81" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1733 { RGB_TO_ULONG(207, 207, 207), "grey81" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1734 { RGB_TO_ULONG(209, 209, 209), "gray82" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1735 { RGB_TO_ULONG(209, 209, 209), "grey82" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1736 { RGB_TO_ULONG(212, 212, 212), "gray83" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1737 { RGB_TO_ULONG(212, 212, 212), "grey83" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1738 { RGB_TO_ULONG(214, 214, 214), "gray84" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1739 { RGB_TO_ULONG(214, 214, 214), "grey84" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1740 { RGB_TO_ULONG(217, 217, 217), "gray85" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1741 { RGB_TO_ULONG(217, 217, 217), "grey85" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1742 { RGB_TO_ULONG(219, 219, 219), "gray86" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1743 { RGB_TO_ULONG(219, 219, 219), "grey86" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1744 { RGB_TO_ULONG(222, 222, 222), "gray87" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1745 { RGB_TO_ULONG(222, 222, 222), "grey87" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1746 { RGB_TO_ULONG(224, 224, 224), "gray88" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1747 { RGB_TO_ULONG(224, 224, 224), "grey88" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1748 { RGB_TO_ULONG(227, 227, 227), "gray89" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1749 { RGB_TO_ULONG(227, 227, 227), "grey89" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1750 { RGB_TO_ULONG(229, 229, 229), "gray90" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1751 { RGB_TO_ULONG(229, 229, 229), "grey90" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1752 { RGB_TO_ULONG(232, 232, 232), "gray91" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1753 { RGB_TO_ULONG(232, 232, 232), "grey91" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1754 { RGB_TO_ULONG(235, 235, 235), "gray92" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1755 { RGB_TO_ULONG(235, 235, 235), "grey92" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1756 { RGB_TO_ULONG(237, 237, 237), "gray93" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1757 { RGB_TO_ULONG(237, 237, 237), "grey93" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1758 { RGB_TO_ULONG(240, 240, 240), "gray94" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1759 { RGB_TO_ULONG(240, 240, 240), "grey94" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1760 { RGB_TO_ULONG(242, 242, 242), "gray95" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1761 { RGB_TO_ULONG(242, 242, 242), "grey95" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1762 { RGB_TO_ULONG(245, 245, 245), "gray96" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1763 { RGB_TO_ULONG(245, 245, 245), "grey96" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1764 { RGB_TO_ULONG(247, 247, 247), "gray97" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1765 { RGB_TO_ULONG(247, 247, 247), "grey97" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1766 { RGB_TO_ULONG(250, 250, 250), "gray98" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1767 { RGB_TO_ULONG(250, 250, 250), "grey98" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1768 { RGB_TO_ULONG(252, 252, 252), "gray99" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1769 { RGB_TO_ULONG(252, 252, 252), "grey99" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1770 { RGB_TO_ULONG(255, 255, 255), "gray100" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1771 { RGB_TO_ULONG(255, 255, 255), "grey100" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1772 { RGB_TO_ULONG(169, 169, 169), "dark grey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1773 { RGB_TO_ULONG(169, 169, 169), "DarkGrey" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1774 { RGB_TO_ULONG(169, 169, 169), "dark gray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1775 { RGB_TO_ULONG(169, 169, 169), "DarkGray" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1776 { RGB_TO_ULONG(0 , 0 , 139), "dark blue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1777 { RGB_TO_ULONG(0 , 0 , 139), "DarkBlue" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1778 { RGB_TO_ULONG(0 , 139, 139), "dark cyan" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1779 { RGB_TO_ULONG(0 , 139, 139), "DarkCyan" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1780 { RGB_TO_ULONG(139, 0 , 139), "dark magenta" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1781 { RGB_TO_ULONG(139, 0 , 139), "DarkMagenta" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1782 { RGB_TO_ULONG(139, 0 , 0 ), "dark red" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1783 { RGB_TO_ULONG(139, 0 , 0 ), "DarkRed" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1784 { RGB_TO_ULONG(144, 238, 144), "light green" },
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1785 { RGB_TO_ULONG(144, 238, 144), "LightGreen" }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1786 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1787
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1788 unsigned long
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1789 mac_color_map_lookup (colorname)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1790 char *colorname;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1791 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1792 Lisp_Object ret = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1793 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1794
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1795 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1796
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1797 for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1798 if (stricmp (colorname, mac_color_map[i].name) == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1799 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1800 ret = mac_color_map[i].color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1801 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1802 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1803
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1804 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1805
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1806 return ret;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1807 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1808
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1809 Lisp_Object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1810 x_to_mac_color (colorname)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1811 char * colorname;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1812 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1813 register Lisp_Object tail, ret = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1814
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1815 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1816
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1817 if (colorname[0] == '#')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1818 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1819 /* Could be an old-style RGB Device specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1820 char *color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1821 int size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1822 color = colorname + 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1823
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1824 size = strlen(color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1825 if (size == 3 || size == 6 || size == 9 || size == 12)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1826 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1827 unsigned long colorval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1828 int i, pos;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1829 pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1830 size /= 3;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1831 colorval = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1832
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1833 for (i = 0; i < 3; i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1834 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1835 char *end;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1836 char t;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1837 unsigned long value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1838
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1839 /* The check for 'x' in the following conditional takes into
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1840 account the fact that strtol allows a "0x" in front of
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1841 our numbers, and we don't. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1842 if (!isxdigit(color[0]) || color[1] == 'x')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1843 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1844 t = color[size];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1845 color[size] = '\0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1846 value = strtoul(color, &end, 16);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1847 color[size] = t;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1848 if (errno == ERANGE || end - color != size)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1849 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1850 switch (size)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1851 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1852 case 1:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1853 value = value * 0x10;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1854 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1855 case 2:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1856 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1857 case 3:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1858 value /= 0x10;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1859 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1860 case 4:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1861 value /= 0x100;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1862 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1863 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1864 colorval |= (value << pos);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1865 pos += 0x8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1866 if (i == 2)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1867 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1868 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1869 return (colorval);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1870 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1871 color = end;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1872 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1873 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1874 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1875 else if (strnicmp(colorname, "rgb:", 4) == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1876 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1877 char *color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1878 unsigned long colorval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1879 int i, pos;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1880 pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1881
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1882 colorval = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1883 color = colorname + 4;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1884 for (i = 0; i < 3; i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1885 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1886 char *end;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1887 unsigned long value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1888
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1889 /* The check for 'x' in the following conditional takes into
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1890 account the fact that strtol allows a "0x" in front of
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1891 our numbers, and we don't. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1892 if (!isxdigit(color[0]) || color[1] == 'x')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1893 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1894 value = strtoul(color, &end, 16);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1895 if (errno == ERANGE)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1896 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1897 switch (end - color)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1898 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1899 case 1:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1900 value = value * 0x10 + value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1901 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1902 case 2:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1903 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1904 case 3:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1905 value /= 0x10;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1906 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1907 case 4:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1908 value /= 0x100;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1909 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1910 default:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1911 value = ULONG_MAX;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1912 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1913 if (value == ULONG_MAX)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1914 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1915 colorval |= (value << pos);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1916 pos += 0x8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1917 if (i == 2)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1918 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1919 if (*end != '\0')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1920 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1921 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1922 return (colorval);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1923 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1924 if (*end != '/')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1925 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1926 color = end + 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1927 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1928 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1929 else if (strnicmp(colorname, "rgbi:", 5) == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1930 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1931 /* This is an RGB Intensity specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1932 char *color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1933 unsigned long colorval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1934 int i, pos;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1935 pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1936
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1937 colorval = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1938 color = colorname + 5;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1939 for (i = 0; i < 3; i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1940 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1941 char *end;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1942 double value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1943 unsigned long val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1944
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1945 value = strtod(color, &end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1946 if (errno == ERANGE)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1947 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1948 if (value < 0.0 || value > 1.0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1949 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1950 val = (unsigned long)(0x100 * value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1951 /* We used 0x100 instead of 0xFF to give an continuous
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1952 range between 0.0 and 1.0 inclusive. The next statement
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1953 fixes the 1.0 case. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1954 if (val == 0x100)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1955 val = 0xFF;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1956 colorval |= (val << pos);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1957 pos += 0x8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1958 if (i == 2)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1959 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1960 if (*end != '\0')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1961 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1962 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1963 return (colorval);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1964 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1965 if (*end != '/')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1966 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1967 color = end + 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1968 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1969 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1970
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1971 ret = mac_color_map_lookup (colorname);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1972
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1973 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1974 return ret;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1975 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1976
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1977 /* Gamma-correct COLOR on frame F. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1978
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1979 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1980 gamma_correct (f, color)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1981 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1982 unsigned long *color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1983 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1984 if (f->gamma)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1985 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1986 unsigned long red, green, blue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1987
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1988 red = pow (RED_FROM_ULONG (*color) / 255.0, f->gamma) * 255.0 + 0.5;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1989 green = pow (GREEN_FROM_ULONG (*color) / 255.0, f->gamma) * 255.0 + 0.5;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1990 blue = pow (BLUE_FROM_ULONG (*color) / 255.0, f->gamma) * 255.0 + 0.5;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1991 *color = RGB_TO_ULONG (red, green, blue);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1992 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1993 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1994
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1995 /* Decide if color named COLOR is valid for the display associated
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1996 with the selected frame; if so, return the rgb values in COLOR_DEF.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1997 If ALLOC is nonzero, allocate a new colormap cell. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1998
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
1999 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2000 mac_defined_color (f, color, color_def, alloc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2001 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2002 char *color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2003 XColor *color_def;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2004 int alloc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2005 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2006 register Lisp_Object tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2007 unsigned long mac_color_ref;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2008
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2009 tem = x_to_mac_color (color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2010
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2011 if (!NILP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2012 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2013 if (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2014 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2015 /* Apply gamma correction. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2016 mac_color_ref = XUINT (tem);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2017 gamma_correct (f, &mac_color_ref);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2018 XSETINT (tem, mac_color_ref);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2019 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2020
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2021 color_def->pixel = mac_color_ref;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2022 color_def->red = RED_FROM_ULONG (mac_color_ref);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2023 color_def->green = GREEN_FROM_ULONG (mac_color_ref);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2024 color_def->blue = BLUE_FROM_ULONG (mac_color_ref);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2025
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2026 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2027 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2028 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2029 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2030 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2031 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2032 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2033
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2034 /* Given a string ARG naming a color, compute a pixel value from it
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2035 suitable for screen F.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2036 If F is not a color screen, return DEF (default) regardless of what
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2037 ARG says. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2038
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2039 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2040 x_decode_color (f, arg, def)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2041 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2042 Lisp_Object arg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2043 int def;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2044 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2045 XColor cdef;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2046
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2047 CHECK_STRING (arg, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2048
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2049 if (strcmp (XSTRING (arg)->data, "black") == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2050 return BLACK_PIX_DEFAULT (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2051 else if (strcmp (XSTRING (arg)->data, "white") == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2052 return WHITE_PIX_DEFAULT (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2053
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2054 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2055 if ((FRAME_MAC_DISPLAY_INFO (f)->n_planes
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2056 * FRAME_MAC_DISPLAY_INFO (f)->n_cbits) == 1)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2057 return def;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2058 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2059
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2060 if (mac_defined_color (f, XSTRING (arg)->data, &cdef, 1))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2061 return cdef.pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2062
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2063 /* defined_color failed; return an ultimate default. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2064 return def;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2065 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2066
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2067 /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2068 the previous value of that parameter, NEW_VALUE is the new value. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2069
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2070 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2071 x_set_line_spacing (f, new_value, old_value)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2072 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2073 Lisp_Object new_value, old_value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2074 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2075 if (NILP (new_value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2076 f->extra_line_spacing = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2077 else if (NATNUMP (new_value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2078 f->extra_line_spacing = XFASTINT (new_value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2079 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2080 Fsignal (Qerror, Fcons (build_string ("Illegal line-spacing"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2081 Fcons (new_value, Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2082 if (FRAME_VISIBLE_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2083 redraw_frame (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2084 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2085
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2086
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2087 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2088 the previous value of that parameter, NEW_VALUE is the new value. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2089
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2090 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2091 x_set_screen_gamma (f, new_value, old_value)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2092 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2093 Lisp_Object new_value, old_value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2094 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2095 if (NILP (new_value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2096 f->gamma = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2097 else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2098 /* The value 0.4545 is the normal viewing gamma. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2099 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2100 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2101 Fsignal (Qerror, Fcons (build_string ("Illegal screen-gamma"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2102 Fcons (new_value, Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2103
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2104 clear_face_cache (0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2105 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2106
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2107
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2108 /* Functions called only from `x_set_frame_param'
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2109 to set individual parameters.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2110
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2111 If FRAME_MAC_WINDOW (f) is 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2112 the frame is being created and its window does not exist yet.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2113 In that case, just record the parameter's new value
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2114 in the standard place; do not attempt to change the window. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2115
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2116 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2117 x_set_foreground_color (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2118 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2119 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2120 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2121 FRAME_FOREGROUND_PIXEL (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2122 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2123
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2124 if (FRAME_MAC_WINDOW (f) != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2125 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2126 update_face_from_frame_parameter (f, Qforeground_color, arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2127 if (FRAME_VISIBLE_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2128 redraw_frame (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2129 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2130 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2131
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2132 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2133 x_set_background_color (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2134 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2135 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2136 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2137 FRAME_BACKGROUND_PIXEL (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2138 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2139
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2140 if (FRAME_MAC_WINDOW (f) != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2141 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2142 update_face_from_frame_parameter (f, Qbackground_color, arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2143
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2144 if (FRAME_VISIBLE_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2145 redraw_frame (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2146 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2147 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2148
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2149 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2150 x_set_mouse_color (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2151 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2152 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2153 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2154 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2155 int count;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2156 int mask_color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2157
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2158 if (!EQ (Qnil, arg))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2159 f->output_data.mac->mouse_pixel
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2160 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2161 mask_color = FRAME_BACKGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2162
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2163 /* Don't let pointers be invisible. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2164 if (mask_color == f->output_data.mac->mouse_pixel
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2165 && mask_color == FRAME_BACKGROUND_PIXEL (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2166 f->output_data.mac->mouse_pixel = FRAME_FOREGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2167
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2168 #if 0 /* MAC_TODO : cursor changes */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2169 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2170
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2171 /* It's not okay to crash if the user selects a screwy cursor. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2172 count = x_catch_errors (FRAME_W32_DISPLAY (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2173
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2174 if (!EQ (Qnil, Vx_pointer_shape))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2175 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2176 CHECK_NUMBER (Vx_pointer_shape, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2177 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2178 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2179 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2180 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2181 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2182
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2183 if (!EQ (Qnil, Vx_nontext_pointer_shape))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2184 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2185 CHECK_NUMBER (Vx_nontext_pointer_shape, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2186 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2187 XINT (Vx_nontext_pointer_shape));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2188 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2189 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2190 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_left_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2191 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2192
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2193 if (!EQ (Qnil, Vx_hourglass_pointer_shape))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2194 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2195 CHECK_NUMBER (Vx_hourglass_pointer_shape, 0);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2196 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2197 XINT (Vx_hourglass_pointer_shape));
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2198 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2199 else
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2200 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2201 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2202
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2203 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2204 if (!EQ (Qnil, Vx_mode_pointer_shape))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2205 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2206 CHECK_NUMBER (Vx_mode_pointer_shape, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2207 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2208 XINT (Vx_mode_pointer_shape));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2209 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2210 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2211 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2212 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2213
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2214 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2215 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2216 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2217 cross_cursor
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2218 = XCreateFontCursor (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2219 XINT (Vx_sensitive_text_pointer_shape));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2220 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2221 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2222 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2223
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2224 if (!NILP (Vx_window_horizontal_drag_shape))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2225 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2226 CHECK_NUMBER (Vx_window_horizontal_drag_shape, 0);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2227 horizontal_drag_cursor
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2228 = XCreateFontCursor (FRAME_X_DISPLAY (f),
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2229 XINT (Vx_window_horizontal_drag_shape));
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2230 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2231 else
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2232 horizontal_drag_cursor
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2233 = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_sb_h_double_arrow);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2234
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2235 /* Check and report errors with the above calls. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2236 x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2237 x_uncatch_errors (FRAME_W32_DISPLAY (f), count);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2238
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2239 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2240 XColor fore_color, back_color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2241
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2242 fore_color.pixel = f->output_data.w32->mouse_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2243 back_color.pixel = mask_color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2244 XQueryColor (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2245 DefaultColormap (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2246 DefaultScreen (FRAME_W32_DISPLAY (f))),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2247 &fore_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2248 XQueryColor (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2249 DefaultColormap (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2250 DefaultScreen (FRAME_W32_DISPLAY (f))),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2251 &back_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2252 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2253 &fore_color, &back_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2254 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2255 &fore_color, &back_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2256 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2257 &fore_color, &back_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2258 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2259 &fore_color, &back_color);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2260 XRecolorCursor (FRAME_W32_DISPLAY (f), hourglass_cursor,
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2261 &fore_color, &back_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2262 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2263
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2264 if (FRAME_W32_WINDOW (f) != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2265 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2266
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2267 if (cursor != f->output_data.w32->text_cursor && f->output_data.w32->text_cursor != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2268 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->text_cursor);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2269 f->output_data.w32->text_cursor = cursor;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2270
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2271 if (nontext_cursor != f->output_data.w32->nontext_cursor
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2272 && f->output_data.w32->nontext_cursor != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2273 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->nontext_cursor);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2274 f->output_data.w32->nontext_cursor = nontext_cursor;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2275
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2276 if (hourglass_cursor != f->output_data.w32->hourglass_cursor
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2277 && f->output_data.w32->hourglass_cursor != 0)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2278 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->hourglass_cursor);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2279 f->output_data.w32->hourglass_cursor = hourglass_cursor;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2280
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2281 if (mode_cursor != f->output_data.w32->modeline_cursor
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2282 && f->output_data.w32->modeline_cursor != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2283 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2284 f->output_data.w32->modeline_cursor = mode_cursor;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2285
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2286 if (cross_cursor != f->output_data.w32->cross_cursor
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2287 && f->output_data.w32->cross_cursor != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2288 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2289 f->output_data.w32->cross_cursor = cross_cursor;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2290
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2291 XFlush (FRAME_W32_DISPLAY (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2292 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2293
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2294 update_face_from_frame_parameter (f, Qmouse_color, arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2295 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2296 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2297
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2298 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2299 x_set_cursor_color (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2300 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2301 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2302 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2303 unsigned long fore_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2304
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2305 if (!NILP (Vx_cursor_fore_pixel))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2306 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2307 WHITE_PIX_DEFAULT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2308 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2309 fore_pixel = FRAME_BACKGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2310 f->output_data.mac->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2311
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2312 /* Make sure that the cursor color differs from the background color. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2313 if (f->output_data.mac->cursor_pixel == FRAME_BACKGROUND_PIXEL (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2314 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2315 f->output_data.mac->cursor_pixel = f->output_data.mac->mouse_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2316 if (f->output_data.mac->cursor_pixel == fore_pixel)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2317 fore_pixel = FRAME_BACKGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2318 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2319 FRAME_FOREGROUND_PIXEL (f) = fore_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2320
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2321 #if 0 /* MAC_TODO: cannot figure out what to do (wrong number of params) */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2322 if (FRAME_MAC_WINDOW (f) != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2323 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2324 if (FRAME_VISIBLE_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2325 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2326 x_display_cursor (f, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2327 x_display_cursor (f, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2328 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2329 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2330 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2331
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2332 update_face_from_frame_parameter (f, Qcursor_color, arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2333 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2334
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2335 /* Set the border-color of frame F to pixel value PIX.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2336 Note that this does not fully take effect if done before
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2337 F has an window. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2338 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2339 x_set_border_pixel (f, pix)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2340 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2341 int pix;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2342 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2343 f->output_data.mac->border_pixel = pix;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2344
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2345 if (FRAME_MAC_WINDOW (f) != 0 && f->output_data.mac->border_width > 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2346 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2347 if (FRAME_VISIBLE_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2348 redraw_frame (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2349 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2350 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2351
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2352 /* Set the border-color of frame F to value described by ARG.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2353 ARG can be a string naming a color.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2354 The border-color is used for the border that is drawn by the server.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2355 Note that this does not fully take effect if done before
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2356 F has a window; it must be redone when the window is created. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2357
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2358 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2359 x_set_border_color (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2360 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2361 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2362 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2363 int pix;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2364
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2365 CHECK_STRING (arg, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2366 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2367 x_set_border_pixel (f, pix);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2368 update_face_from_frame_parameter (f, Qborder_color, arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2369 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2370
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2371 /* Value is the internal representation of the specified cursor type
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2372 ARG. If type is BAR_CURSOR, return in *WIDTH the specified width
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2373 of the bar cursor. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2374
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2375 enum text_cursor_kinds
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2376 x_specified_cursor_type (arg, width)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2377 Lisp_Object arg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2378 int *width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2379 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2380 enum text_cursor_kinds type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2381
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2382 if (EQ (arg, Qbar))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2383 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2384 type = BAR_CURSOR;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2385 *width = 2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2386 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2387 else if (CONSP (arg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2388 && EQ (XCAR (arg), Qbar)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2389 && INTEGERP (XCDR (arg))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2390 && XINT (XCDR (arg)) >= 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2391 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2392 type = BAR_CURSOR;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2393 *width = XINT (XCDR (arg));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2394 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2395 else if (NILP (arg))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2396 type = NO_CURSOR;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2397 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2398 /* Treat anything unknown as "box cursor".
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2399 It was bad to signal an error; people have trouble fixing
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2400 .Xdefaults with Emacs, when it has something bad in it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2401 type = FILLED_BOX_CURSOR;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2402
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2403 return type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2404 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2405
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2406 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2407 x_set_cursor_type (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2408 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2409 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2410 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2411 int width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2412
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2413 FRAME_DESIRED_CURSOR (f) = x_specified_cursor_type (arg, &width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2414 f->output_data.mac->cursor_width = width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2415
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2416 /* Make sure the cursor gets redrawn. This is overkill, but how
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2417 often do people change cursor types? */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2418 update_mode_lines++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2419 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2420
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2421 #if 0 /* MAC_TODO: really no icon for Mac */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2422 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2423 x_set_icon_type (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2424 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2425 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2426 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2427 int result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2428
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2429 if (NILP (arg) && NILP (oldval))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2430 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2431
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2432 if (STRINGP (arg) && STRINGP (oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2433 && EQ (Fstring_equal (oldval, arg), Qt))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2434 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2435
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2436 if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2437 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2438
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2439 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2440
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2441 result = x_bitmap_icon (f, arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2442 if (result)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2443 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2444 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2445 error ("No icon window available");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2446 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2447
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2448 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2449 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2450 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2451
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2452 /* Return non-nil if frame F wants a bitmap icon. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2453
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2454 Lisp_Object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2455 x_icon_type (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2456 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2457 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2458 Lisp_Object tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2459
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2460 tem = assq_no_quit (Qicon_type, f->param_alist);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2461 if (CONSP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2462 return XCDR (tem);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2463 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2464 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2465 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2466
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2467 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2468 x_set_icon_name (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2469 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2470 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2471 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2472 int result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2473
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2474 if (STRINGP (arg))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2475 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2476 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2477 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2478 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2479 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2480 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2481
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2482 f->icon_name = arg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2483
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2484 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2485 if (f->output_data.w32->icon_bitmap != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2486 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2487
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2488 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2489
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2490 result = x_text_icon (f,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2491 (char *) XSTRING ((!NILP (f->icon_name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2492 ? f->icon_name
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2493 : !NILP (f->title)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2494 ? f->title
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2495 : f->name))->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2496
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2497 if (result)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2498 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2499 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2500 error ("No icon window available");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2501 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2502
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2503 /* If the window was unmapped (and its icon was mapped),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2504 the new icon is not mapped, so map the window in its stead. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2505 if (FRAME_VISIBLE_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2506 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2507 #ifdef USE_X_TOOLKIT
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2508 XtPopup (f->output_data.w32->widget, XtGrabNone);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2509 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2510 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2511 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2512
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2513 XFlush (FRAME_W32_DISPLAY (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2514 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2515 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2516 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2517
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2518 extern Lisp_Object x_new_font ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2519 extern Lisp_Object x_new_fontset();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2520
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2521 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2522 x_set_font (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2523 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2524 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2525 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2526 Lisp_Object result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2527 Lisp_Object fontset_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2528 Lisp_Object frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2529
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2530 CHECK_STRING (arg, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2531
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2532 fontset_name = Fquery_fontset (arg, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2533
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2534 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2535 result = (STRINGP (fontset_name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2536 ? x_new_fontset (f, XSTRING (fontset_name)->data)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2537 : x_new_font (f, XSTRING (arg)->data));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2538 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2539
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2540 if (EQ (result, Qnil))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2541 error ("Font `%s' is not defined", XSTRING (arg)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2542 else if (EQ (result, Qt))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2543 error ("The characters of the given font have varying widths");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2544 else if (STRINGP (result))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2545 {
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2546 if (!NILP (Fequal (result, oldval)))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2547 return;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2548 store_frame_param (f, Qfont, result);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2549 recompute_basic_faces (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2550 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2551 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2552 abort ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2553
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2554 do_pending_window_change (0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2555
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2556 /* Don't call `face-set-after-frame-default' when faces haven't been
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2557 initialized yet. This is the case when called from
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2558 Fx_create_frame. In that case, the X widget or window doesn't
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2559 exist either, and we can end up in x_report_frame_params with a
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2560 null widget which gives a segfault. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2561 if (FRAME_FACE_CACHE (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2562 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2563 XSETFRAME (frame, f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2564 call1 (Qface_set_after_frame_default, frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2565 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2566 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2567
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
2568 static void
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
2569 x_set_fringe_width (f, new_value, old_value)
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
2570 struct frame *f;
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
2571 Lisp_Object new_value, old_value;
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
2572 {
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
2573 x_compute_fringe_widths (f, 1);
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
2574 }
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
2575
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2576 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2577 x_set_border_width (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2578 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2579 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2580 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2581 CHECK_NUMBER (arg, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2582
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2583 if (XINT (arg) == f->output_data.mac->border_width)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2584 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2585
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2586 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2587 if (FRAME_MAC_WINDOW (f) != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2588 error ("Cannot change the border width of a window");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2589 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2590
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2591 f->output_data.mac->border_width = XINT (arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2592 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2593
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2594 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2595 x_set_internal_border_width (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2596 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2597 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2598 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2599 int old = f->output_data.mac->internal_border_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2600
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2601 CHECK_NUMBER (arg, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2602 f->output_data.mac->internal_border_width = XINT (arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2603 if (f->output_data.mac->internal_border_width < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2604 f->output_data.mac->internal_border_width = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2605
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2606 if (f->output_data.mac->internal_border_width == old)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2607 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2608
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2609 if (FRAME_MAC_WINDOW (f) != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2610 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2611 x_set_window_size (f, 0, f->width, f->height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2612 SET_FRAME_GARBAGED (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2613 do_pending_window_change (0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2614 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2615 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2616
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2617 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2618 x_set_visibility (f, value, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2619 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2620 Lisp_Object value, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2621 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2622 Lisp_Object frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2623 XSETFRAME (frame, f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2624
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2625 if (NILP (value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2626 Fmake_frame_invisible (frame, Qt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2627 else if (EQ (value, Qicon))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2628 Ficonify_frame (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2629 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2630 Fmake_frame_visible (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2631 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2632
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2633
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2634 /* Change window heights in windows rooted in WINDOW by N lines. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2635
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2636 static void
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2637 x_change_window_heights (window, n)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2638 Lisp_Object window;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2639 int n;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2640 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2641 struct window *w = XWINDOW (window);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2642
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2643 XSETFASTINT (w->top, XFASTINT (w->top) + n);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2644 XSETFASTINT (w->height, XFASTINT (w->height) - n);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2645
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2646 if (INTEGERP (w->orig_top))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2647 XSETFASTINT (w->orig_top, XFASTINT (w->orig_top) + n);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2648 if (INTEGERP (w->orig_height))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2649 XSETFASTINT (w->orig_height, XFASTINT (w->orig_height) - n);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2650
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2651 /* Handle just the top child in a vertical split. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2652 if (!NILP (w->vchild))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2653 x_change_window_heights (w->vchild, n);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2654
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2655 /* Adjust all children in a horizontal split. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2656 for (window = w->hchild; !NILP (window); window = w->next)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2657 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2658 w = XWINDOW (window);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2659 x_change_window_heights (window, n);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2660 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2661 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2662
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2663 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2664 x_set_menu_bar_lines (f, value, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2665 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2666 Lisp_Object value, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2667 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2668 int nlines;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2669 int olines = FRAME_MENU_BAR_LINES (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2670
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2671 /* Right now, menu bars don't work properly in minibuf-only frames;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2672 most of the commands try to apply themselves to the minibuffer
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2673 frame itself, and get an error because you can't switch buffers
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2674 in or split the minibuffer window. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2675 if (FRAME_MINIBUF_ONLY_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2676 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2677
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2678 if (INTEGERP (value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2679 nlines = XINT (value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2680 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2681 nlines = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2682
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2683 FRAME_MENU_BAR_LINES (f) = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2684 if (nlines)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2685 FRAME_EXTERNAL_MENU_BAR (f) = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2686 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2687 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2688 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2689 free_frame_menubar (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2690 FRAME_EXTERNAL_MENU_BAR (f) = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2691
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2692 /* Adjust the frame size so that the client (text) dimensions
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2693 remain the same. This depends on FRAME_EXTERNAL_MENU_BAR being
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2694 set correctly. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2695 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2696 do_pending_window_change (0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2697 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2698 adjust_glyphs (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2699 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2700
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2701 /* Set the number of lines used for the tool bar of frame F to VALUE.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2702 VALUE not an integer, or < 0 means set the lines to zero. OLDVAL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2703 is the old number of tool bar lines. This function changes the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2704 height of all windows on frame F to match the new tool bar height.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2705 The frame's height doesn't change. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2706
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2707 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2708 x_set_tool_bar_lines (f, value, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2709 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2710 Lisp_Object value, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2711 {
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2712 int delta, nlines, root_height;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2713 Lisp_Object root_window;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2714
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2715 /* Treat tool bars like menu bars. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2716 if (FRAME_MINIBUF_ONLY_P (f))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2717 return;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2718
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2719 /* Use VALUE only if an integer >= 0. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2720 if (INTEGERP (value) && XINT (value) >= 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2721 nlines = XFASTINT (value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2722 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2723 nlines = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2724
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2725 /* Make sure we redisplay all windows in this frame. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2726 ++windows_or_buffers_changed;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2727
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2728 delta = nlines - FRAME_TOOL_BAR_LINES (f);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2729
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2730 /* Don't resize the tool-bar to more than we have room for. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2731 root_window = FRAME_ROOT_WINDOW (f);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2732 root_height = XINT (XWINDOW (root_window)->height);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2733 if (root_height - delta < 1)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2734 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2735 delta = root_height - 1;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2736 nlines = FRAME_TOOL_BAR_LINES (f) + delta;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2737 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2738
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2739 FRAME_TOOL_BAR_LINES (f) = nlines;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2740 x_change_window_heights (root_window, delta);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2741 adjust_glyphs (f);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2742
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2743 /* We also have to make sure that the internal border at the top of
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2744 the frame, below the menu bar or tool bar, is redrawn when the
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2745 tool bar disappears. This is so because the internal border is
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2746 below the tool bar if one is displayed, but is below the menu bar
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2747 if there isn't a tool bar. The tool bar draws into the area
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2748 below the menu bar. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2749 if (FRAME_MAC_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2750 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2751 updating_frame = f;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2752 clear_frame ();
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2753 clear_current_matrices (f);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2754 updating_frame = NULL;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2755 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2756
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2757 /* If the tool bar gets smaller, the internal border below it
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2758 has to be cleared. It was formerly part of the display
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2759 of the larger tool bar, and updating windows won't clear it. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2760 if (delta < 0)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2761 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2762 int height = FRAME_INTERNAL_BORDER_WIDTH (f);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2763 int width = PIXEL_WIDTH (f);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2764 int y = nlines * CANON_Y_UNIT (f);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2765
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2766 BLOCK_INPUT;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2767 XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2768 0, y, width, height, 0);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2769 UNBLOCK_INPUT;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
2770 }
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2771 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2772
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2773
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2774 /* Change the name of frame F to NAME. If NAME is nil, set F's name to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2775 w32_id_name.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2776
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2777 If EXPLICIT is non-zero, that indicates that lisp code is setting the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2778 name; if NAME is a string, set F's name to NAME and set
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2779 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2780
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2781 If EXPLICIT is zero, that indicates that Emacs redisplay code is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2782 suggesting a new name, which lisp code should override; if
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2783 F->explicit_name is set, ignore the new name; otherwise, set it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2784
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2785 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2786 x_set_name (f, name, explicit)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2787 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2788 Lisp_Object name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2789 int explicit;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2790 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2791 /* Make sure that requests from lisp code override requests from
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2792 Emacs redisplay code. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2793 if (explicit)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2794 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2795 /* If we're switching from explicit to implicit, we had better
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2796 update the mode lines and thereby update the title. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2797 if (f->explicit_name && NILP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2798 update_mode_lines = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2799
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2800 f->explicit_name = ! NILP (name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2801 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2802 else if (f->explicit_name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2803 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2804
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2805 /* If NAME is nil, set the name to the w32_id_name. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2806 if (NILP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2807 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2808 /* Check for no change needed in this very common case
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2809 before we do any consing. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2810 if (!strcmp (FRAME_MAC_DISPLAY_INFO (f)->mac_id_name,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2811 XSTRING (f->name)->data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2812 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2813 name = build_string (FRAME_MAC_DISPLAY_INFO (f)->mac_id_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2814 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2815 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2816 CHECK_STRING (name, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2817
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2818 /* Don't change the name if it's already NAME. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2819 if (! NILP (Fstring_equal (name, f->name)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2820 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2821
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2822 f->name = name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2823
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2824 /* For setting the frame title, the title parameter should override
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2825 the name parameter. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2826 if (! NILP (f->title))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2827 name = f->title;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2828
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2829 if (FRAME_MAC_WINDOW (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2830 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2831 if (STRING_MULTIBYTE (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2832 #if 0 /* MAC_TODO: encoding title string */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2833 name = ENCODE_SYSTEM (name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2834 #else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2835 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2836 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2837
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2838 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2839
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2840 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2841 Str255 windowTitle;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2842 if (strlen (XSTRING (name)->data) < 255)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2843 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2844 strcpy (windowTitle, XSTRING (name)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2845 c2pstr (windowTitle);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2846 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2847 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2848 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2849
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2850 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2851 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2852 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2853
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2854 /* This function should be called when the user's lisp code has
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2855 specified a name for the frame; the name will override any set by the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2856 redisplay code. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2857 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2858 x_explicitly_set_name (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2859 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2860 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2861 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2862 x_set_name (f, arg, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2863 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2864
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2865 /* This function should be called by Emacs redisplay code to set the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2866 name; names set this way will never override names set by the user's
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2867 lisp code. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2868 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2869 x_implicitly_set_name (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2870 FRAME_PTR f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2871 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2872 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2873 x_set_name (f, arg, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2874 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2875
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2876 /* Change the title of frame F to NAME.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2877 If NAME is nil, use the frame name as the title.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2878
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2879 If EXPLICIT is non-zero, that indicates that lisp code is setting the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2880 name; if NAME is a string, set F's name to NAME and set
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2881 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2882
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2883 If EXPLICIT is zero, that indicates that Emacs redisplay code is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2884 suggesting a new name, which lisp code should override; if
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2885 F->explicit_name is set, ignore the new name; otherwise, set it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2886
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2887 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2888 x_set_title (f, name, old_name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2889 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2890 Lisp_Object name, old_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2891 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2892 /* Don't change the title if it's already NAME. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2893 if (EQ (name, f->title))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2894 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2895
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2896 update_mode_lines = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2897
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2898 f->title = name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2899
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2900 if (NILP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2901 name = f->name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2902
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2903 if (FRAME_MAC_WINDOW (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2904 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2905 if (STRING_MULTIBYTE (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2906 #if 0 /* MAC_TODO: encoding title string */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2907 name = ENCODE_SYSTEM (name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2908 #else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2909 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2910 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2911
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2912 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2913
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2914 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2915 Str255 windowTitle;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2916 if (strlen (XSTRING (name)->data) < 255)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2917 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2918 strcpy (windowTitle, XSTRING (name)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2919 c2pstr (windowTitle);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2920 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2921 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2922 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2923
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2924 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2925 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2926 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2927
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2928 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2929 x_set_autoraise (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2930 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2931 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2932 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2933 f->auto_raise = !EQ (Qnil, arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2934 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2935
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2936 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2937 x_set_autolower (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2938 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2939 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2940 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2941 f->auto_lower = !EQ (Qnil, arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2942 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2943
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2944 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2945 x_set_unsplittable (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2946 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2947 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2948 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2949 f->no_split = !NILP (arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2950 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2951
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2952 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2953 x_set_vertical_scroll_bars (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2954 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2955 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2956 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2957 if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2958 || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2959 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2960 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2961 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2962 FRAME_VERTICAL_SCROLL_BAR_TYPE (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2963 = (NILP (arg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2964 ? vertical_scroll_bar_none
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2965 : EQ (Qright, arg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2966 ? vertical_scroll_bar_right
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2967 : vertical_scroll_bar_left);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2968
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2969 /* We set this parameter before creating the window for the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2970 frame, so we can get the geometry right from the start.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2971 However, if the window hasn't been created yet, we shouldn't
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2972 call x_set_window_size. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2973 if (FRAME_MAC_WINDOW (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2974 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2975 do_pending_window_change (0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2976 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2977 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2978
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2979 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2980 x_set_scroll_bar_width (f, arg, oldval)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2981 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2982 Lisp_Object arg, oldval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2983 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2984 /* Imitate X without X Toolkit */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2985
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2986 int wid = FONT_WIDTH (f->output_data.mac->font);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2987
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2988 if (NILP (arg))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2989 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2990 /* Make the actual width at least 14 pixels and a multiple of a
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2991 character width. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2992 FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2993
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2994 /* Use all of that space (aside from required margins) for the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2995 scroll bar. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2996 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2997
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2998 if (FRAME_MAC_WINDOW (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
2999 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3000 do_pending_window_change (0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3001 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3002 else if (INTEGERP (arg) && XINT (arg) > 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3003 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3004 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3005 if (XFASTINT (arg) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3006 XSETINT (arg, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM + 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3007
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3008 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3009 FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3010 if (FRAME_MAC_WINDOW (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3011 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3012 do_pending_window_change (0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3013 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3014 change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3015 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3016 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3017 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3018
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3019 /* Subroutines of creating an frame. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3020
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3021 /* Make sure that Vx_resource_name is set to a reasonable value.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3022 Fix it up, or set it to `emacs' if it is too hopeless. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3023
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3024 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3025 validate_x_resource_name ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3026 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3027 int len = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3028 /* Number of valid characters in the resource name. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3029 int good_count = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3030 /* Number of invalid characters in the resource name. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3031 int bad_count = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3032 Lisp_Object new;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3033 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3034
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3035 if (STRINGP (Vx_resource_name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3036 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3037 unsigned char *p = XSTRING (Vx_resource_name)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3038 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3039
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3040 len = STRING_BYTES (XSTRING (Vx_resource_name));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3041
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3042 /* Only letters, digits, - and _ are valid in resource names.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3043 Count the valid characters and count the invalid ones. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3044 for (i = 0; i < len; i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3045 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3046 int c = p[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3047 if (! ((c >= 'a' && c <= 'z')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3048 || (c >= 'A' && c <= 'Z')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3049 || (c >= '0' && c <= '9')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3050 || c == '-' || c == '_'))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3051 bad_count++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3052 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3053 good_count++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3054 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3055 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3056 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3057 /* Not a string => completely invalid. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3058 bad_count = 5, good_count = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3059
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3060 /* If name is valid already, return. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3061 if (bad_count == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3062 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3063
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3064 /* If name is entirely invalid, or nearly so, use `emacs'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3065 if (good_count == 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3066 || (good_count == 1 && bad_count > 0))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3067 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3068 Vx_resource_name = build_string ("emacs");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3069 return;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3070 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3071
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3072 /* Name is partly valid. Copy it and replace the invalid characters
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3073 with underscores. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3074
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3075 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3076
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3077 for (i = 0; i < len; i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3078 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3079 int c = XSTRING (new)->data[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3080 if (! ((c >= 'a' && c <= 'z')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3081 || (c >= 'A' && c <= 'Z')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3082 || (c >= '0' && c <= '9')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3083 || c == '-' || c == '_'))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3084 XSTRING (new)->data[i] = '_';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3085 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3086 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3087
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3088
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3089 #if 0 /* MAC_TODO: implement resource strings */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3090 extern char *x_get_string_resource ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3091
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3092 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3093 "Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3094 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3095 class, where INSTANCE is the name under which Emacs was invoked, or\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3096 the name specified by the `-name' or `-rn' command-line arguments.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3097 \n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3098 The optional arguments COMPONENT and SUBCLASS add to the key and the\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3099 class, respectively. You must specify both of them or neither.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3100 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3101 and the class is `Emacs.CLASS.SUBCLASS'.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3102 (attribute, class, component, subclass)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3103 Lisp_Object attribute, class, component, subclass;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3104 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3105 register char *value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3106 char *name_key;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3107 char *class_key;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3108
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3109 CHECK_STRING (attribute, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3110 CHECK_STRING (class, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3111
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3112 if (!NILP (component))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3113 CHECK_STRING (component, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3114 if (!NILP (subclass))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3115 CHECK_STRING (subclass, 2);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3116 if (NILP (component) != NILP (subclass))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3117 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3118
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3119 validate_x_resource_name ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3120
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3121 /* Allocate space for the components, the dots which separate them,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3122 and the final '\0'. Make them big enough for the worst case. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3123 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3124 + (STRINGP (component)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3125 ? STRING_BYTES (XSTRING (component)) : 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3126 + STRING_BYTES (XSTRING (attribute))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3127 + 3);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3128
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3129 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3130 + STRING_BYTES (XSTRING (class))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3131 + (STRINGP (subclass)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3132 ? STRING_BYTES (XSTRING (subclass)) : 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3133 + 3);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3134
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3135 /* Start with emacs.FRAMENAME for the name (the specific one)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3136 and with `Emacs' for the class key (the general one). */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3137 strcpy (name_key, XSTRING (Vx_resource_name)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3138 strcpy (class_key, EMACS_CLASS);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3139
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3140 strcat (class_key, ".");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3141 strcat (class_key, XSTRING (class)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3142
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3143 if (!NILP (component))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3144 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3145 strcat (class_key, ".");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3146 strcat (class_key, XSTRING (subclass)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3147
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3148 strcat (name_key, ".");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3149 strcat (name_key, XSTRING (component)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3150 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3151
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3152 strcat (name_key, ".");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3153 strcat (name_key, XSTRING (attribute)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3154
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3155 value = x_get_string_resource (Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3156 name_key, class_key);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3157
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3158 if (value != (char *) 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3159 return build_string (value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3160 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3161 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3162 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3163
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3164 /* Used when C code wants a resource value. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3165
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3166 char *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3167 x_get_resource_string (attribute, class)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3168 char *attribute, *class;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3169 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3170 char *name_key;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3171 char *class_key;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3172 struct frame *sf = SELECTED_FRAME ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3173
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3174 /* Allocate space for the components, the dots which separate them,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3175 and the final '\0'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3176 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3177 + strlen (attribute) + 2);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3178 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3179 + strlen (class) + 2);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3180
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3181 sprintf (name_key, "%s.%s",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3182 XSTRING (Vinvocation_name)->data,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3183 attribute);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3184 sprintf (class_key, "%s.%s", EMACS_CLASS, class);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3185
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3186 return x_get_string_resource (sf, name_key, class_key);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3187 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3188 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3189
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3190 /* Types we might convert a resource string into. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3191 enum resource_types
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3192 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3193 RES_TYPE_NUMBER,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3194 RES_TYPE_FLOAT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3195 RES_TYPE_BOOLEAN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3196 RES_TYPE_STRING,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3197 RES_TYPE_SYMBOL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3198 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3199
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3200 /* Return the value of parameter PARAM.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3201
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3202 First search ALIST, then Vdefault_frame_alist, then the X defaults
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3203 database, using ATTRIBUTE as the attribute name and CLASS as its class.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3204
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3205 Convert the resource to the type specified by desired_type.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3206
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3207 If no default is specified, return Qunbound. If you call
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3208 w32_get_arg, make sure you deal with Qunbound in a reasonable way,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3209 and don't let it get stored in any Lisp-visible variables! */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3210
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3211 static Lisp_Object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3212 mac_get_arg (alist, param, attribute, class, type)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3213 Lisp_Object alist, param;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3214 char *attribute;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3215 char *class;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3216 enum resource_types type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3217 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3218 register Lisp_Object tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3219
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3220 tem = Fassq (param, alist);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3221 if (EQ (tem, Qnil))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3222 tem = Fassq (param, Vdefault_frame_alist);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3223 if (EQ (tem, Qnil))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3224 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3225
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3226 #if 0 /* MAC_TODO: search resource also */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3227 if (attribute)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3228 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3229 tem = Fx_get_resource (build_string (attribute),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3230 build_string (class),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3231 Qnil, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3232
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3233 if (NILP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3234 return Qunbound;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3235
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3236 switch (type)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3237 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3238 case RES_TYPE_NUMBER:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3239 return make_number (atoi (XSTRING (tem)->data));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3240
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3241 case RES_TYPE_FLOAT:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3242 return make_float (atof (XSTRING (tem)->data));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3243
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3244 case RES_TYPE_BOOLEAN:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3245 tem = Fdowncase (tem);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3246 if (!strcmp (XSTRING (tem)->data, "on")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3247 || !strcmp (XSTRING (tem)->data, "true"))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3248 return Qt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3249 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3250 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3251
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3252 case RES_TYPE_STRING:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3253 return tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3254
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3255 case RES_TYPE_SYMBOL:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3256 /* As a special case, we map the values `true' and `on'
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3257 to Qt, and `false' and `off' to Qnil. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3258 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3259 Lisp_Object lower;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3260 lower = Fdowncase (tem);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3261 if (!strcmp (XSTRING (lower)->data, "on")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3262 || !strcmp (XSTRING (lower)->data, "true"))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3263 return Qt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3264 else if (!strcmp (XSTRING (lower)->data, "off")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3265 || !strcmp (XSTRING (lower)->data, "false"))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3266 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3267 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3268 return Fintern (tem, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3269 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3270
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3271 default:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3272 abort ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3273 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3274 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3275 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3276 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3277 return Qunbound;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3278 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3279 return Fcdr (tem);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3280 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3281
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3282 /* Record in frame F the specified or default value according to ALIST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3283 of the parameter named PROP (a Lisp symbol).
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3284 If no value is specified for PROP, look for an X default for XPROP
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3285 on the frame named NAME.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3286 If that is not found either, use the value DEFLT. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3287
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3288 static Lisp_Object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3289 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3290 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3291 Lisp_Object alist;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3292 Lisp_Object prop;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3293 Lisp_Object deflt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3294 char *xprop;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3295 char *xclass;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3296 enum resource_types type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3297 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3298 Lisp_Object tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3299
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3300 tem = mac_get_arg (alist, prop, xprop, xclass, type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3301 if (EQ (tem, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3302 tem = deflt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3303 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3304 return tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3305 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3306
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3307 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3308 "Parse an X-style geometry string STRING.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3309 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3310 The properties returned may include `top', `left', `height', and `width'.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3311 The value of `left' or `top' may be an integer,\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3312 or a list (+ N) meaning N pixels relative to top/left corner,\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3313 or a list (- N) meaning -N pixels relative to bottom/right corner.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3314 (string)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3315 Lisp_Object string;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3316 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3317 int geometry, x, y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3318 unsigned int width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3319 Lisp_Object result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3320
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3321 CHECK_STRING (string, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3322
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3323 geometry = XParseGeometry ((char *) XSTRING (string)->data,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3324 &x, &y, &width, &height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3325
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3326 result = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3327 if (geometry & XValue)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3328 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3329 Lisp_Object element;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3330
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3331 if (x >= 0 && (geometry & XNegative))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3332 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3333 else if (x < 0 && ! (geometry & XNegative))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3334 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3335 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3336 element = Fcons (Qleft, make_number (x));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3337 result = Fcons (element, result);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3338 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3339
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3340 if (geometry & YValue)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3341 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3342 Lisp_Object element;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3343
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3344 if (y >= 0 && (geometry & YNegative))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3345 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3346 else if (y < 0 && ! (geometry & YNegative))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3347 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3348 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3349 element = Fcons (Qtop, make_number (y));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3350 result = Fcons (element, result);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3351 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3352
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3353 if (geometry & WidthValue)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3354 result = Fcons (Fcons (Qwidth, make_number (width)), result);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3355 if (geometry & HeightValue)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3356 result = Fcons (Fcons (Qheight, make_number (height)), result);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3357
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3358 return result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3359 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3360
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3361 /* Calculate the desired size and position of this window,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3362 and return the flags saying which aspects were specified.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3363
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3364 This function does not make the coordinates positive. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3365
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3366 #define DEFAULT_ROWS 40
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3367 #define DEFAULT_COLS 80
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3368
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3369 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3370 x_figure_window_size (f, parms)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3371 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3372 Lisp_Object parms;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3373 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3374 register Lisp_Object tem0, tem1, tem2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3375 long window_prompting = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3376
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3377 /* Default values if we fall through.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3378 Actually, if that happens we should get
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3379 window manager prompting. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3380 SET_FRAME_WIDTH (f, DEFAULT_COLS);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3381 f->height = DEFAULT_ROWS;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3382 /* Window managers expect that if program-specified
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3383 positions are not (0,0), they're intentional, not defaults. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3384 f->output_data.mac->top_pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3385 f->output_data.mac->left_pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3386
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3387 tem0 = mac_get_arg (parms, Qheight, 0, 0, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3388 tem1 = mac_get_arg (parms, Qwidth, 0, 0, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3389 tem2 = mac_get_arg (parms, Quser_size, 0, 0, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3390 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3391 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3392 if (!EQ (tem0, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3393 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3394 CHECK_NUMBER (tem0, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3395 f->height = XINT (tem0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3396 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3397 if (!EQ (tem1, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3398 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3399 CHECK_NUMBER (tem1, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3400 SET_FRAME_WIDTH (f, XINT (tem1));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3401 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3402 if (!NILP (tem2) && !EQ (tem2, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3403 window_prompting |= USSize;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3404 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3405 window_prompting |= PSize;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3406 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3407
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3408 f->output_data.mac->vertical_scroll_bar_extra
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3409 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3410 ? 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3411 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3412 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3413 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.mac->font)));
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
3414 x_compute_fringe_widths (f, 0);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3415 f->output_data.mac->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3416 f->output_data.mac->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3417
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3418 tem0 = mac_get_arg (parms, Qtop, 0, 0, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3419 tem1 = mac_get_arg (parms, Qleft, 0, 0, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3420 tem2 = mac_get_arg (parms, Quser_position, 0, 0, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3421 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3422 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3423 if (EQ (tem0, Qminus))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3424 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3425 f->output_data.mac->top_pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3426 window_prompting |= YNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3427 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3428 else if (CONSP (tem0) && EQ (XCAR (tem0), Qminus)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3429 && CONSP (XCDR (tem0))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3430 && INTEGERP (XCAR (XCDR (tem0))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3431 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3432 f->output_data.mac->top_pos = - XINT (XCAR (XCDR (tem0)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3433 window_prompting |= YNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3434 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3435 else if (CONSP (tem0) && EQ (XCAR (tem0), Qplus)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3436 && CONSP (XCDR (tem0))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3437 && INTEGERP (XCAR (XCDR (tem0))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3438 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3439 f->output_data.mac->top_pos = XINT (XCAR (XCDR (tem0)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3440 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3441 else if (EQ (tem0, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3442 f->output_data.mac->top_pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3443 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3444 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3445 CHECK_NUMBER (tem0, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3446 f->output_data.mac->top_pos = XINT (tem0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3447 if (f->output_data.mac->top_pos < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3448 window_prompting |= YNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3449 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3450
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3451 if (EQ (tem1, Qminus))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3452 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3453 f->output_data.mac->left_pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3454 window_prompting |= XNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3455 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3456 else if (CONSP (tem1) && EQ (XCAR (tem1), Qminus)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3457 && CONSP (XCDR (tem1))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3458 && INTEGERP (XCAR (XCDR (tem1))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3459 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3460 f->output_data.mac->left_pos = - XINT (XCAR (XCDR (tem1)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3461 window_prompting |= XNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3462 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3463 else if (CONSP (tem1) && EQ (XCAR (tem1), Qplus)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3464 && CONSP (XCDR (tem1))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3465 && INTEGERP (XCAR (XCDR (tem1))))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3466 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3467 f->output_data.mac->left_pos = XINT (XCAR (XCDR (tem1)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3468 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3469 else if (EQ (tem1, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3470 f->output_data.mac->left_pos = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3471 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3472 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3473 CHECK_NUMBER (tem1, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3474 f->output_data.mac->left_pos = XINT (tem1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3475 if (f->output_data.mac->left_pos < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3476 window_prompting |= XNegative;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3477 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3478
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3479 if (!NILP (tem2) && ! EQ (tem2, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3480 window_prompting |= USPosition;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3481 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3482 window_prompting |= PPosition;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3483 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3484
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3485 return window_prompting;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3486 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3487
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3488
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3489 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3490 /* Create and set up the Mac window for frame F. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3491
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3492 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3493 mac_window (f, window_prompting, minibuffer_only)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3494 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3495 long window_prompting;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3496 int minibuffer_only;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3497 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3498 Rect r;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3499
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3500 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3501
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3502 /* Use the resource name as the top-level window name
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3503 for looking up resources. Make a non-Lisp copy
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3504 for the window manager, so GC relocation won't bother it.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3505
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3506 Elsewhere we specify the window name for the window manager. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3507
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3508 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3509 char *str = (char *) XSTRING (Vx_resource_name)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3510 f->namebuf = (char *) xmalloc (strlen (str) + 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3511 strcpy (f->namebuf, str);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3512 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3513
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3514 SetRect (&r, f->output_data.mac->left_pos, f->output_data.mac->top_pos,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3515 f->output_data.mac->left_pos + PIXEL_WIDTH (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3516 f->output_data.mac->top_pos + PIXEL_HEIGHT (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3517 FRAME_MAC_WINDOW (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3518 = NewCWindow (NULL, &r, "\p", 1, zoomDocProc, (WindowPtr) -1, 1, (long) f->output_data.mac);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3519
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3520 validate_x_resource_name ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3521
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3522 /* x_set_name normally ignores requests to set the name if the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3523 requested name is the same as the current name. This is the one
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3524 place where that assumption isn't correct; f->name is set, but
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3525 the server hasn't been told. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3526 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3527 Lisp_Object name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3528 int explicit = f->explicit_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3529
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3530 f->explicit_name = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3531 name = f->name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3532 f->name = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3533 x_set_name (f, name, explicit);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3534 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3535
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3536 ShowWindow (FRAME_MAC_WINDOW (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3537
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3538 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3539
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3540 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3541 initialize_frame_menubar (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3542
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3543 if (FRAME_MAC_WINDOW (f) == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3544 error ("Unable to create window");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3545 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3546 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3547
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3548 /* Handle the icon stuff for this window. Perhaps later we might
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3549 want an x_set_icon_position which can be called interactively as
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3550 well. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3551
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3552 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3553 x_icon (f, parms)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3554 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3555 Lisp_Object parms;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3556 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3557 Lisp_Object icon_x, icon_y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3558
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3559 /* Set the position of the icon. Note that Windows 95 groups all
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3560 icons in the tray. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3561 icon_x = mac_get_arg (parms, Qicon_left, 0, 0, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3562 icon_y = mac_get_arg (parms, Qicon_top, 0, 0, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3563 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3564 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3565 CHECK_NUMBER (icon_x, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3566 CHECK_NUMBER (icon_y, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3567 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3568 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3569 error ("Both left and top icon corners of icon must be specified");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3570
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3571 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3572
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3573 if (! EQ (icon_x, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3574 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3575
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3576 #if 0 /* TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3577 /* Start up iconic or window? */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3578 x_wm_set_window_state
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3579 (f, (EQ (w32_get_arg (parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL), Qicon)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3580 ? IconicState
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3581 : NormalState));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3582
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3583 x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3584 ? f->icon_name
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3585 : f->name))->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3586 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3587
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3588 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3589 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3590
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3591
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3592 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3593 x_make_gc (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3594 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3595 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3596 XGCValues gc_values;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3597
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3598 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3599
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3600 /* Create the GC's of this frame.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3601 Note that many default values are used. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3602
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3603 /* Normal video */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3604 gc_values.font = f->output_data.mac->font;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3605 gc_values.foreground = f->output_data.mac->foreground_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3606 gc_values.background = f->output_data.mac->background_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3607 f->output_data.mac->normal_gc = XCreateGC (FRAME_MAC_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3608 FRAME_MAC_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3609 GCFont | GCForeground | GCBackground,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3610 &gc_values);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3611
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3612 /* Reverse video style. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3613 gc_values.foreground = f->output_data.mac->background_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3614 gc_values.background = f->output_data.mac->foreground_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3615 f->output_data.mac->reverse_gc = XCreateGC (FRAME_MAC_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3616 FRAME_MAC_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3617 GCFont | GCForeground | GCBackground,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3618 &gc_values);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3619
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3620 /* Cursor has cursor-color background, background-color foreground. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3621 gc_values.foreground = f->output_data.mac->background_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3622 gc_values.background = f->output_data.mac->cursor_pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3623 f->output_data.mac->cursor_gc = XCreateGC (FRAME_MAC_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3624 FRAME_MAC_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3625 GCFont | GCForeground | GCBackground,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3626 &gc_values);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3627
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3628 /* Reliefs. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3629 f->output_data.mac->white_relief.gc = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3630 f->output_data.mac->black_relief.gc = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3631
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3632 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3633 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3634
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3635
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3636 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3637 1, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3638 "Make a new window, which is called a \"frame\" in Emacs terms.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3639 Returns an Emacs frame object.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3640 ALIST is an alist of frame parameters.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3641 If the parameters specify that the frame should not have a minibuffer,\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3642 and do not specify a specific minibuffer window to use,\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3643 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3644 be shared by the new frame.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3645 \n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3646 This function is an internal primitive--use `make-frame' instead.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3647 (parms)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3648 Lisp_Object parms;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3649 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3650 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3651 Lisp_Object frame, tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3652 Lisp_Object name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3653 int minibuffer_only = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3654 long window_prompting = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3655 int width, height;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
3656 int count = BINDING_STACK_SIZE ();
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3657 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3658 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3659 struct mac_display_info *dpyinfo = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3660 Lisp_Object parent;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3661 struct kboard *kb;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3662 char x_frame_name[10];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3663 static int x_frame_count = 2; /* starts from 2 because terminal frame is F1 */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3664
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3665 check_mac ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3666
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3667 /* Use this general default value to start with
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3668 until we know if this frame has a specified name. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3669 Vx_resource_name = Vinvocation_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3670
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3671 display = mac_get_arg (parms, Qdisplay, 0, 0, RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3672 if (EQ (display, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3673 display = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3674 dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3675 #ifdef MULTI_KBOARD
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3676 kb = dpyinfo->kboard;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3677 #else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3678 kb = &the_only_kboard;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3679 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3680
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3681 name = mac_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3682 if (!STRINGP (name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3683 && ! EQ (name, Qunbound)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3684 && ! NILP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3685 error ("Invalid frame name--not a string or nil");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3686
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3687 if (STRINGP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3688 Vx_resource_name = name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3689
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3690 /* See if parent window is specified. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3691 parent = mac_get_arg (parms, Qparent_id, NULL, NULL, RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3692 if (EQ (parent, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3693 parent = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3694 if (! NILP (parent))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3695 CHECK_NUMBER (parent, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3696
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3697 /* make_frame_without_minibuffer can run Lisp code and garbage collect. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3698 /* No need to protect DISPLAY because that's not used after passing
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3699 it to make_frame_without_minibuffer. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3700 frame = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3701 GCPRO4 (parms, parent, name, frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3702 tem = mac_get_arg (parms, Qminibuffer, 0, 0, RES_TYPE_SYMBOL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3703 if (EQ (tem, Qnone) || NILP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3704 f = make_frame_without_minibuffer (Qnil, kb, display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3705 else if (EQ (tem, Qonly))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3706 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3707 f = make_minibuffer_frame ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3708 minibuffer_only = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3709 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3710 else if (WINDOWP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3711 f = make_frame_without_minibuffer (tem, kb, display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3712 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3713 f = make_frame (1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3714
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3715 if (EQ (name, Qunbound) || NILP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3716 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3717 sprintf (x_frame_name, "F%d", x_frame_count++);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3718 f->name = build_string (x_frame_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3719 f->explicit_name = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3720 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3721 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3722 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3723 f->name = name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3724 f->explicit_name = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3725 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3726
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3727 XSETFRAME (frame, f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3728
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3729 /* Note that X Windows does support scroll bars. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3730 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3731
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3732 f->output_method = output_mac;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3733 f->output_data.mac = (struct mac_output *) xmalloc (sizeof (struct mac_output));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3734 bzero (f->output_data.mac, sizeof (struct mac_output));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3735 f->output_data.mac->fontset = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3736 f->output_data.mac->scroll_bar_foreground_pixel = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3737 f->output_data.mac->scroll_bar_background_pixel = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3738
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3739 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3740 FRAME_FONTSET (f) = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3741 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3742
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3743 f->icon_name
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3744 = mac_get_arg (parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3745 if (! STRINGP (f->icon_name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3746 f->icon_name = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3747
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3748 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3749 #ifdef MULTI_KBOARD
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3750 FRAME_KBOARD (f) = kb;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3751 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3753 /* Specify the parent under which to make this window. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3754
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3755 if (!NILP (parent))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3756 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3757 f->output_data.mac->parent_desc = (Window) parent;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3758 f->output_data.mac->explicit_parent = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3759 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3760 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3761 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3762 f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3763 f->output_data.mac->explicit_parent = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3764 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3765
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3766 /* Set the name; the functions to which we pass f expect the name to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3767 be set. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3768 if (EQ (name, Qunbound) || NILP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3769 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3770 f->name = build_string (dpyinfo->mac_id_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3771 f->explicit_name = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3772 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3773 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3774 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3775 f->name = name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3776 f->explicit_name = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3777 /* use the frame's title when getting resources for this frame. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3778 specbind (Qx_resource_name, name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3779 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3780
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3781 /* Extract the window parameters from the supplied values
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3782 that are needed to determine window geometry. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3783 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3784 Lisp_Object font;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3785
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3786 font = mac_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3787
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3788 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3789 /* First, try whatever font the caller has specified. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3790 if (STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3791 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3792 tem = Fquery_fontset (font, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3793 if (STRINGP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3794 font = x_new_fontset (f, XSTRING (tem)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3795 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3796 font = x_new_font (f, XSTRING (font)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3797 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3798 /* Try out a font which we hope has bold and italic variations. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3799 if (! STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3800 font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3801 /* If those didn't work, look for something which will at least work. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3802 if (!STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3803 font = x_new_font (f, "-*-monaco-*-12-*-mac-roman");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3804 if (! STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3805 font = x_new_font (f, "-*-courier-*-10-*-mac-roman");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3806 if (! STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3807 error ("Cannot find any usable font");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3808 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3809
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3810 x_default_parameter (f, parms, Qfont, font,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3811 "font", "Font", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3812 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3813
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3814 x_default_parameter (f, parms, Qborder_width, make_number (0),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3815 "borderwidth", "BorderWidth", RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3816 /* This defaults to 2 in order to match xterm. We recognize either
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3817 internalBorderWidth or internalBorder (which is what xterm calls
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3818 it). */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3819 if (NILP (Fassq (Qinternal_border_width, parms)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3820 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3821 Lisp_Object value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3822
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3823 value = mac_get_arg (parms, Qinternal_border_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3824 "internalBorder", "BorderWidth", RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3825 if (! EQ (value, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3826 parms = Fcons (Fcons (Qinternal_border_width, value),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3827 parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3828 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3829
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3830 /* Default internalBorderWidth to 0 on Windows to match other programs. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3831 x_default_parameter (f, parms, Qinternal_border_width, make_number (0),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3832 "internalBorderWidth", "BorderWidth", RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3833
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3834 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3835 "verticalScrollBars", "ScrollBars", RES_TYPE_BOOLEAN);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3836
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3837 /* Also do the stuff which must be set before the window exists. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3838 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3839 "foreground", "Foreground", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3840 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3841 "background", "Background", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3842 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3843 "pointerColor", "Foreground", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3844 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3845 "cursorColor", "Foreground", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3846 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3847 "borderColor", "BorderColor", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3848 x_default_parameter (f, parms, Qscreen_gamma, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3849 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3850 x_default_parameter (f, parms, Qline_spacing, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3851 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER);
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
3852 x_default_parameter (f, parms, Qleft_fringe, Qnil,
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
3853 "leftFringe", "LeftFringe", RES_TYPE_NUMBER);
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
3854 x_default_parameter (f, parms, Qright_fringe, Qnil,
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41132
diff changeset
3855 "rightFringe", "RightFringe", RES_TYPE_NUMBER);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3856
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3857 /* Init faces before x_default_parameter is called for scroll-bar
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3858 parameters because that function calls x_set_scroll_bar_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3859 which calls change_frame_size, which calls Fset_window_buffer,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3860 which runs hooks, which call Fvertical_motion. At the end, we
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3861 end up in init_iterator with a null face cache, which should not
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3862 happen. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3863 init_frame_faces (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3864
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3865 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3866 "menuBar", "MenuBar", RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3867 x_default_parameter (f, parms, Qtool_bar_lines, make_number (0),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3868 "toolBar", "ToolBar", RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3869 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3870 x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3871 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3872 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3873 x_default_parameter (f, parms, Qtitle, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3874 "title", "Title", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3875
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3876 f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3877 window_prompting = x_figure_window_size (f, parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3878
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3879 if (window_prompting & XNegative)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3880 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3881 if (window_prompting & YNegative)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3882 f->output_data.mac->win_gravity = SouthEastGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3883 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3884 f->output_data.mac->win_gravity = NorthEastGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3885 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3886 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3887 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3888 if (window_prompting & YNegative)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3889 f->output_data.mac->win_gravity = SouthWestGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3890 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3891 f->output_data.mac->win_gravity = NorthWestGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3892 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3893
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3894 f->output_data.mac->size_hint_flags = window_prompting;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3895
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3896 tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3897 f->no_split = minibuffer_only || EQ (tem, Qt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3898
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3899 /* Create the window. Add the tool-bar height to the initial frame
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3900 height so that the user gets a text display area of the size he
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3901 specified with -g or via the registry. Later changes of the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3902 tool-bar height don't change the frame size. This is done so that
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3903 users can create tall Emacs frames without having to guess how
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3904 tall the tool-bar will get. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3905 f->height += FRAME_TOOL_BAR_LINES (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3906
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3907 /* mac_window (f, window_prompting, minibuffer_only); */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3908 make_mac_frame (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3909
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3910 x_icon (f, parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3911
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3912 x_make_gc (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3913
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3914 /* Now consider the frame official. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3915 FRAME_MAC_DISPLAY_INFO (f)->reference_count++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3916 Vframe_list = Fcons (frame, Vframe_list);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3917
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3918 /* We need to do this after creating the window, so that the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3919 icon-creation functions can say whose icon they're describing. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3920 x_default_parameter (f, parms, Qicon_type, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3921 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3922
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3923 x_default_parameter (f, parms, Qauto_raise, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3924 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3925 x_default_parameter (f, parms, Qauto_lower, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3926 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3927 x_default_parameter (f, parms, Qcursor_type, Qbox,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3928 "cursorType", "CursorType", RES_TYPE_SYMBOL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3929 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3930 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3931
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3932 /* Dimensions, especially f->height, must be done via change_frame_size.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3933 Change will not be effected unless different from the current
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3934 f->height. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3935
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3936 width = f->width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3937 height = f->height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3938 f->height = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3939 SET_FRAME_WIDTH (f, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3940 change_frame_size (f, height, width, 1, 0, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3941
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3942 /* Set up faces after all frame parameters are known. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3943 call1 (Qface_set_after_frame_default, frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3944
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3945 #if 0 /* MAC_TODO: when we have window manager hints */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3946 /* Tell the server what size and position, etc, we want, and how
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3947 badly we want them. This should be done after we have the menu
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3948 bar so that its size can be taken into account. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3949 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3950 x_wm_set_size_hint (f, window_prompting, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3951 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3952 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3953
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3954 /* Make the window appear on the frame and enable display, unless
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3955 the caller says not to. However, with explicit parent, Emacs
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3956 cannot control visibility, so don't try. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3957 if (! f->output_data.mac->explicit_parent)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3958 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3959 Lisp_Object visibility;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3960
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3961 visibility = mac_get_arg (parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3962 if (EQ (visibility, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3963 visibility = Qt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3964
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3965 #if 0 /* MAC_TODO: really no iconify on Mac */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3966 if (EQ (visibility, Qicon))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3967 x_iconify_frame (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3968 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3969 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3970 if (! NILP (visibility))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3971 x_make_frame_visible (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3972 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3973 /* Must have been Qnil. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3974 ;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3975 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3976
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3977 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3978 return unbind_to (count, frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3979 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3980
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3981 /* FRAME is used only to get a handle on the X display. We don't pass the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3982 display info directly because we're called from frame.c, which doesn't
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3983 know about that structure. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3984 Lisp_Object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3985 x_get_focus_frame (frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3986 struct frame *frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3987 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3988 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3989 Lisp_Object xfocus;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3990 if (! dpyinfo->x_focus_frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3991 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3992
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3993 XSETFRAME (xfocus, dpyinfo->x_focus_frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3994 return xfocus;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3995 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3996
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3997 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3998 "Internal function called by `color-defined-p', which see.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
3999 (color, frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4000 Lisp_Object color, frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4001 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4002 XColor foo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4003 FRAME_PTR f = check_x_frame (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4004
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4005 CHECK_STRING (color, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4006
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4007 if (mac_defined_color (f, XSTRING (color)->data, &foo, 0))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4008 return Qt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4009 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4010 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4011 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4012
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4013 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4014 "Internal function called by `color-values', which see.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4015 (color, frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4016 Lisp_Object color, frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4017 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4018 XColor foo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4019 FRAME_PTR f = check_x_frame (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4020
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4021 CHECK_STRING (color, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4022
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4023 if (mac_defined_color (f, XSTRING (color)->data, &foo, 0))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4024 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4025 Lisp_Object rgb[3];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4026
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4027 rgb[0] = make_number ((RED_FROM_ULONG (foo.pixel) << 8)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4028 | RED_FROM_ULONG (foo.pixel));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4029 rgb[1] = make_number ((GREEN_FROM_ULONG (foo.pixel) << 8)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4030 | GREEN_FROM_ULONG (foo.pixel));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4031 rgb[2] = make_number ((BLUE_FROM_ULONG (foo.pixel) << 8)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4032 | BLUE_FROM_ULONG (foo.pixel));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4033 return Flist (3, rgb);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4034 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4035 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4036 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4037 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4038
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4039 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4040 "Internal function called by `display-color-p', which see.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4041 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4042 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4043 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4044 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4045
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4046 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4047 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4048
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4049 return Qt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4050 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4051
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4052 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4053 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4054 "Return t if the X display supports shades of gray.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4055 Note that color displays do support shades of gray.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4056 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4057 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4058 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4059 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4060 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4061 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4062 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4063
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4064 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4065 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4066
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4067 return Qt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4068 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4069
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4070 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4071 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4072 "Returns the width in pixels of the X display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4073 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4074 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4075 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4076 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4077 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4078 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4079 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4080
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4081 return make_number (dpyinfo->width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4082 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4083
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4084 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4085 Sx_display_pixel_height, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4086 "Returns the height in pixels of the X display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4087 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4088 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4089 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4090 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4091 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4092 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4093 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4094
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4095 return make_number (dpyinfo->height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4096 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4097
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4098 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4099 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4100 "Returns the number of bitplanes of the display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4101 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4102 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4103 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4104 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4105 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4106 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4107 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4108
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4109 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4110 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4111
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4112 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4113 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4114 "Returns the number of color cells of the display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4115 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4116 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4117 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4118 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4119 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4120 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4121 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4122
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4123 /* MAC_TODO: check whether this is right */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4124 return make_number ((unsigned long) (pow (2, dpyinfo->n_cbits)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4125 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4126
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4127 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4128 Sx_server_max_request_size,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4129 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4130 "Returns the maximum request size of the server of display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4131 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4132 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4133 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4134 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4135 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4136 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4137 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4138
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4139 return make_number (1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4140 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4141
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4142 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4143 "Returns the vendor ID string of the W32 system (Microsoft).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4144 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4145 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4146 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4147 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4148 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4149 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4150 return build_string ("Apple Computers");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4151 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4152
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4153 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4154 "Returns the version numbers of the server of display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4155 The value is a list of three integers: the major and minor\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4156 version numbers, and the vendor-specific release\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4157 number. See also the function `x-server-vendor'.\n\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4158 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4159 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4160 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4161 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4162 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4163 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4164 int mac_major_version, mac_minor_version;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4165 SInt32 response;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4166
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4167 if (Gestalt (gestaltSystemVersion, &response) != noErr)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4168 error ("Cannot get Mac OS version");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4169
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4170 mac_major_version = (response >> 8) & 0xf;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4171 mac_minor_version = (response >> 4) & 0xf;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4172
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4173 return Fcons (make_number (mac_major_version),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4174 Fcons (make_number (mac_minor_version), Qnil));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4175 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4176
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4177 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4178 "Returns the number of screens on the server of display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4179 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4180 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4181 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4182 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4183 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4184 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4185 return make_number (1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4186 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4187
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4188 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4189 "Returns the height in millimeters of the X display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4190 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4191 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4192 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4193 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4194 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4195 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4196 /* MAC_TODO: this is an approximation, and only of the main display */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4197
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4198 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4199 short h, v;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4200
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4201 ScreenRes (&h, &v);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4202
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4203 return make_number ((int) (v / 72.0 * 25.4));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4204 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4205
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4206 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4207 "Returns the width in millimeters of the X display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4208 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4209 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4210 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4211 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4212 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4213 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4214 /* MAC_TODO: this is an approximation, and only of the main display */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4215
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4216 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4217 short h, v;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4218
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4219 ScreenRes (&h, &v);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4220
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4221 return make_number ((int) (h / 72.0 * 25.4));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4222 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4223
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4224 DEFUN ("x-display-backing-store", Fx_display_backing_store,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4225 Sx_display_backing_store, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4226 "Returns an indication of whether display DISPLAY does backing store.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4227 The value may be `always', `when-mapped', or `not-useful'.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4228 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4229 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4230 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4231 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4232 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4233 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4234 return intern ("not-useful");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4235 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4236
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4237 DEFUN ("x-display-visual-class", Fx_display_visual_class,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4238 Sx_display_visual_class, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4239 "Returns the visual class of the display DISPLAY.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4240 The value is one of the symbols `static-gray', `gray-scale',\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4241 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4242 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4243 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4244 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4245 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4246 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4247 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4248 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4249
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4250 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4251 switch (dpyinfo->visual->class)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4252 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4253 case StaticGray: return (intern ("static-gray"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4254 case GrayScale: return (intern ("gray-scale"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4255 case StaticColor: return (intern ("static-color"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4256 case PseudoColor: return (intern ("pseudo-color"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4257 case TrueColor: return (intern ("true-color"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4258 case DirectColor: return (intern ("direct-color"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4259 default:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4260 error ("Display has an unknown visual class");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4261 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4262 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4263
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4264 error ("Display has an unknown visual class");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4265 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4266
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4267 DEFUN ("x-display-save-under", Fx_display_save_under,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4268 Sx_display_save_under, 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4269 "Returns t if the display DISPLAY supports the save-under feature.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4270 The optional argument DISPLAY specifies which display to ask about.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4271 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4272 If omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4273 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4274 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4275 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4276 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4277 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4278
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4279 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4280 x_pixel_width (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4281 register struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4282 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4283 return PIXEL_WIDTH (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4284 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4285
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4286 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4287 x_pixel_height (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4288 register struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4289 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4290 return PIXEL_HEIGHT (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4291 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4292
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4293 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4294 x_char_width (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4295 register struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4296 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4297 return FONT_WIDTH (f->output_data.mac->font);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4298 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4299
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4300 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4301 x_char_height (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4302 register struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4303 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4304 return f->output_data.mac->line_height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4305 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4306
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4307 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4308 x_screen_planes (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4309 register struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4310 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4311 return FRAME_MAC_DISPLAY_INFO (f)->n_planes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4312 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4313
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4314 /* Return the display structure for the display named NAME.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4315 Open a new connection if necessary. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4316
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4317 struct mac_display_info *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4318 x_display_info_for_name (name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4319 Lisp_Object name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4320 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4321 Lisp_Object names;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4322 struct mac_display_info *dpyinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4323
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4324 CHECK_STRING (name, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4325
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4326 for (dpyinfo = &one_mac_display_info, names = x_display_name_list;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4327 dpyinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4328 dpyinfo = dpyinfo->next, names = XCDR (names))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4329 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4330 Lisp_Object tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4331 tem = Fstring_equal (XCAR (XCAR (names)), name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4332 if (!NILP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4333 return dpyinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4334 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4335
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4336 /* Use this general default value to start with. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4337 Vx_resource_name = Vinvocation_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4338
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4339 validate_x_resource_name ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4340
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4341 dpyinfo = x_term_init (name, (unsigned char *) 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4342 (char *) XSTRING (Vx_resource_name)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4343
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4344 if (dpyinfo == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4345 error ("Cannot connect to server %s", XSTRING (name)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4346
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4347 mac_in_use = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4348 XSETFASTINT (Vwindow_system_version, 3);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4349
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4350 return dpyinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4351 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4352
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4353 #if 0 /* MAC_TODO: implement network support */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4354 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4355 1, 3, 0, "Open a connection to a server.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4356 DISPLAY is the name of the display to connect to.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4357 Optional second arg XRM-STRING is a string of resources in xrdb format.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4358 If the optional third arg MUST-SUCCEED is non-nil,\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4359 terminate Emacs if we can't open the connection.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4360 (display, xrm_string, must_succeed)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4361 Lisp_Object display, xrm_string, must_succeed;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4362 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4363 unsigned char *xrm_option;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4364 struct mac_display_info *dpyinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4365
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4366 CHECK_STRING (display, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4367 if (! NILP (xrm_string))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4368 CHECK_STRING (xrm_string, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4369
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4370 if (! EQ (Vwindow_system, intern ("mac")))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4371 error ("Not using Mac OS");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4372
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4373 if (! NILP (xrm_string))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4374 xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4375 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4376 xrm_option = (unsigned char *) 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4377
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4378 validate_x_resource_name ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4379
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4380 /* This is what opens the connection and sets x_current_display.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4381 This also initializes many symbols, such as those used for input. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4382 dpyinfo = mac_term_init (display, xrm_option,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4383 (char *) XSTRING (Vx_resource_name)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4384
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4385 if (dpyinfo == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4386 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4387 if (!NILP (must_succeed))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4388 fatal ("Cannot connect to server %s.\n",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4389 XSTRING (display)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4390 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4391 error ("Cannot connect to server %s", XSTRING (display)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4392 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4393
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4394 mac_in_use = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4395
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4396 XSETFASTINT (Vwindow_system_version, 3);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4397 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4398 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4399
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4400 DEFUN ("x-close-connection", Fx_close_connection,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4401 Sx_close_connection, 1, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4402 "Close the connection to DISPLAY's server.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4403 For DISPLAY, specify either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4404 If DISPLAY is nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4405 (display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4406 Lisp_Object display;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4407 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4408 struct mac_display_info *dpyinfo = check_x_display_info (display);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4409 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4410
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4411 if (dpyinfo->reference_count > 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4412 error ("Display still has frames on it");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4413
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4414 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4415 /* Free the fonts in the font table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4416 for (i = 0; i < dpyinfo->n_fonts; i++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4417 if (dpyinfo->font_table[i].name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4418 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4419 if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4420 xfree (dpyinfo->font_table[i].full_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4421 xfree (dpyinfo->font_table[i].name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4422 x_unload_font (dpyinfo, dpyinfo->font_table[i].font);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4423 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4424 x_destroy_all_bitmaps (dpyinfo);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4425
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4426 x_delete_display (dpyinfo);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4427 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4428
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4429 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4430 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4431 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4432
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4433 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4434 "Return the list of display names that Emacs has connections to.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4435 ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4436 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4437 Lisp_Object tail, result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4438
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4439 result = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4440 for (tail = x_display_name_list; ! NILP (tail); tail = XCDR (tail))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4441 result = Fcons (XCAR (XCAR (tail)), result);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4442
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4443 return result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4444 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4445
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4446 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4447 "If ON is non-nil, report errors as soon as the erring request is made.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4448 If ON is nil, allow buffering of requests.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4449 This is a noop on W32 systems.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4450 The optional second argument DISPLAY specifies which display to act on.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4451 DISPLAY should be either a frame or a display name (a string).\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4452 If DISPLAY is omitted or nil, that stands for the selected frame's display.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4453 (on, display)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4454 Lisp_Object display, on;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4455 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4456 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4457 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4458
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4459
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4460 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4461 Image types
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4462 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4463
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4464 /* Value is the number of elements of vector VECTOR. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4465
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4466 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4467
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4468 /* List of supported image types. Use define_image_type to add new
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4469 types. Use lookup_image_type to find a type for a given symbol. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4470
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4471 static struct image_type *image_types;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4472
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4473 /* The symbol `image' which is the car of the lists used to represent
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4474 images in Lisp. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4475
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4476 extern Lisp_Object Qimage;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4477
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4478 /* The symbol `xbm' which is used as the type symbol for XBM images. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4479
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4480 Lisp_Object Qxbm;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4481
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4482 /* Keywords. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4483
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4484 extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4485 extern Lisp_Object QCdata;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4486 Lisp_Object QCtype, QCascent, QCmargin, QCrelief;
35660
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
4487 Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4488 Lisp_Object QCindex;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4489
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4490 /* Other symbols. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4491
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4492 Lisp_Object Qlaplace;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4493
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4494 /* Time in seconds after which images should be removed from the cache
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4495 if not displayed. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4496
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4497 Lisp_Object Vimage_cache_eviction_delay;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4498
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4499 /* Function prototypes. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4500
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4501 static void define_image_type P_ ((struct image_type *type));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4502 static struct image_type *lookup_image_type P_ ((Lisp_Object symbol));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4503 static void image_error P_ ((char *format, Lisp_Object, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4504 static void x_laplace P_ ((struct frame *, struct image *));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4505 static int x_build_heuristic_mask P_ ((struct frame *, struct image *,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4506 Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4507
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4508
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4509 /* Define a new image type from TYPE. This adds a copy of TYPE to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4510 image_types and adds the symbol *TYPE->type to Vimage_types. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4511
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4512 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4513 define_image_type (type)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4514 struct image_type *type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4515 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4516 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4517 The initialized data segment is read-only. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4518 struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4519 bcopy (type, p, sizeof *p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4520 p->next = image_types;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4521 image_types = p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4522 Vimage_types = Fcons (*p->type, Vimage_types);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4523 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4524
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4525
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4526 /* Look up image type SYMBOL, and return a pointer to its image_type
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4527 structure. Value is null if SYMBOL is not a known image type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4528
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4529 static INLINE struct image_type *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4530 lookup_image_type (symbol)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4531 Lisp_Object symbol;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4532 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4533 struct image_type *type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4534
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4535 for (type = image_types; type; type = type->next)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4536 if (EQ (symbol, *type->type))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4537 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4538
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4539 return type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4540 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4541
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4542
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4543 /* Value is non-zero if OBJECT is a valid Lisp image specification. A
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4544 valid image specification is a list whose car is the symbol
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4545 `image', and whose rest is a property list. The property list must
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4546 contain a value for key `:type'. That value must be the name of a
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4547 supported image type. The rest of the property list depends on the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4548 image type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4549
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4550 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4551 valid_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4552 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4553 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4554 int valid_p = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4555
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4556 if (CONSP (object) && EQ (XCAR (object), Qimage))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4557 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4558 Lisp_Object symbol = Fplist_get (XCDR (object), QCtype);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4559 struct image_type *type = lookup_image_type (symbol);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4560
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4561 if (type)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4562 valid_p = type->valid_p (object);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4563 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4564
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4565 return valid_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4566 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4567
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4568
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4569 /* Log error message with format string FORMAT and argument ARG.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4570 Signaling an error, e.g. when an image cannot be loaded, is not a
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4571 good idea because this would interrupt redisplay, and the error
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4572 message display would lead to another redisplay. This function
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4573 therefore simply displays a message. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4574
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4575 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4576 image_error (format, arg1, arg2)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4577 char *format;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4578 Lisp_Object arg1, arg2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4579 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4580 add_to_log (format, arg1, arg2);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4581 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4582
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4583
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4584
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4585 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4586 Image specifications
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4587 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4588
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4589 enum image_value_type
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4590 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4591 IMAGE_DONT_CHECK_VALUE_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4592 IMAGE_STRING_VALUE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4593 IMAGE_SYMBOL_VALUE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4594 IMAGE_POSITIVE_INTEGER_VALUE,
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4595 IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR,
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4596 IMAGE_NON_NEGATIVE_INTEGER_VALUE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4597 IMAGE_ASCENT_VALUE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4598 IMAGE_INTEGER_VALUE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4599 IMAGE_FUNCTION_VALUE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4600 IMAGE_NUMBER_VALUE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4601 IMAGE_BOOL_VALUE
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4602 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4603
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4604 /* Structure used when parsing image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4605
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4606 struct image_keyword
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4607 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4608 /* Name of keyword. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4609 char *name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4610
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4611 /* The type of value allowed. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4612 enum image_value_type type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4613
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4614 /* Non-zero means key must be present. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4615 int mandatory_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4616
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4617 /* Used to recognize duplicate keywords in a property list. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4618 int count;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4619
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4620 /* The value that was found. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4621 Lisp_Object value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4622 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4623
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4624
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4625 static int parse_image_spec P_ ((Lisp_Object, struct image_keyword *,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4626 int, Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4627 static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4628
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4629
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4630 /* Parse image spec SPEC according to KEYWORDS. A valid image spec
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4631 has the format (image KEYWORD VALUE ...). One of the keyword/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4632 value pairs must be `:type TYPE'. KEYWORDS is a vector of
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4633 image_keywords structures of size NKEYWORDS describing other
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4634 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4635
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4636 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4637 parse_image_spec (spec, keywords, nkeywords, type)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4638 Lisp_Object spec;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4639 struct image_keyword *keywords;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4640 int nkeywords;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4641 Lisp_Object type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4642 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4643 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4644 Lisp_Object plist;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4645
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4646 if (!CONSP (spec) || !EQ (XCAR (spec), Qimage))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4647 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4648
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4649 plist = XCDR (spec);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4650 while (CONSP (plist))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4651 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4652 Lisp_Object key, value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4653
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4654 /* First element of a pair must be a symbol. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4655 key = XCAR (plist);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4656 plist = XCDR (plist);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4657 if (!SYMBOLP (key))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4658 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4659
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4660 /* There must follow a value. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4661 if (!CONSP (plist))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4662 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4663 value = XCAR (plist);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4664 plist = XCDR (plist);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4665
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4666 /* Find key in KEYWORDS. Error if not found. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4667 for (i = 0; i < nkeywords; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4668 if (strcmp (keywords[i].name, XSYMBOL (key)->name->data) == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4669 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4670
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4671 if (i == nkeywords)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4672 continue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4673
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4674 /* Record that we recognized the keyword. If a keywords
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4675 was found more than once, it's an error. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4676 keywords[i].value = value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4677 ++keywords[i].count;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4678
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4679 if (keywords[i].count > 1)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4680 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4681
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4682 /* Check type of value against allowed type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4683 switch (keywords[i].type)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4684 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4685 case IMAGE_STRING_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4686 if (!STRINGP (value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4687 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4688 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4689
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4690 case IMAGE_SYMBOL_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4691 if (!SYMBOLP (value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4692 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4693 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4694
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4695 case IMAGE_POSITIVE_INTEGER_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4696 if (!INTEGERP (value) || XINT (value) <= 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4697 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4698 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4699
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4700 case IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR:
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4701 if (INTEGERP (value) && XINT (value) >= 0)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4702 break;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4703 if (CONSP (value)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4704 && INTEGERP (XCAR (value)) && INTEGERP (XCDR (value))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4705 && XINT (XCAR (value)) >= 0 && XINT (XCDR (value)) >= 0)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4706 break;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4707 return 0;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
4708
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4709 case IMAGE_ASCENT_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4710 if (SYMBOLP (value) && EQ (value, Qcenter))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4711 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4712 else if (INTEGERP (value)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4713 && XINT (value) >= 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4714 && XINT (value) <= 100)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4715 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4716 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4717
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4718 case IMAGE_NON_NEGATIVE_INTEGER_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4719 if (!INTEGERP (value) || XINT (value) < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4720 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4721 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4722
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4723 case IMAGE_DONT_CHECK_VALUE_TYPE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4724 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4725
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4726 case IMAGE_FUNCTION_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4727 value = indirect_function (value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4728 if (SUBRP (value)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4729 || COMPILEDP (value)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4730 || (CONSP (value) && EQ (XCAR (value), Qlambda)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4731 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4732 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4733
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4734 case IMAGE_NUMBER_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4735 if (!INTEGERP (value) && !FLOATP (value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4736 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4737 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4738
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4739 case IMAGE_INTEGER_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4740 if (!INTEGERP (value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4741 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4742 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4743
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4744 case IMAGE_BOOL_VALUE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4745 if (!NILP (value) && !EQ (value, Qt))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4746 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4747 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4748
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4749 default:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4750 abort ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4751 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4752 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4753
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4754 if (EQ (key, QCtype) && !EQ (type, value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4755 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4756 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4757
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4758 /* Check that all mandatory fields are present. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4759 for (i = 0; i < nkeywords; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4760 if (keywords[i].mandatory_p && keywords[i].count == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4761 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4762
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4763 return NILP (plist);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4764 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4765
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4766
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4767 /* Return the value of KEY in image specification SPEC. Value is nil
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4768 if KEY is not present in SPEC. if FOUND is not null, set *FOUND
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4769 to 1 if KEY was found in SPEC, set it to 0 otherwise. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4770
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4771 static Lisp_Object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4772 image_spec_value (spec, key, found)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4773 Lisp_Object spec, key;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4774 int *found;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4775 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4776 Lisp_Object tail;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4777
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4778 xassert (valid_image_p (spec));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4779
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4780 for (tail = XCDR (spec);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4781 CONSP (tail) && CONSP (XCDR (tail));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4782 tail = XCDR (XCDR (tail)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4783 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4784 if (EQ (XCAR (tail), key))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4785 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4786 if (found)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4787 *found = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4788 return XCAR (XCDR (tail));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4789 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4790 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4791
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4792 if (found)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4793 *found = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4794 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4795 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4796
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4797
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4798
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4799
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4800 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4801 Image type independent image structures
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4802 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4803
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4804 static struct image *make_image P_ ((Lisp_Object spec, unsigned hash));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4805 static void free_image P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4806
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4807
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4808 /* Allocate and return a new image structure for image specification
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4809 SPEC. SPEC has a hash value of HASH. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4810
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4811 static struct image *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4812 make_image (spec, hash)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4813 Lisp_Object spec;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4814 unsigned hash;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4815 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4816 struct image *img = (struct image *) xmalloc (sizeof *img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4817
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4818 xassert (valid_image_p (spec));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4819 bzero (img, sizeof *img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4820 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4821 xassert (img->type != NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4822 img->spec = spec;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4823 img->data.lisp_val = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4824 img->ascent = DEFAULT_IMAGE_ASCENT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4825 img->hash = hash;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4826 return img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4827 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4828
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4829
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4830 /* Free image IMG which was used on frame F, including its resources. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4831
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4832 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4833 free_image (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4834 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4835 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4836 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4837 if (img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4838 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4839 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4840
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4841 /* Remove IMG from the hash table of its cache. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4842 if (img->prev)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4843 img->prev->next = img->next;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4844 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4845 c->buckets[img->hash % IMAGE_CACHE_BUCKETS_SIZE] = img->next;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4846
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4847 if (img->next)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4848 img->next->prev = img->prev;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4849
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4850 c->images[img->id] = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4851
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4852 /* Free resources, then free IMG. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4853 img->type->free (f, img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4854 xfree (img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4855 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4856 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4857
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4858
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4859 /* Prepare image IMG for display on frame F. Must be called before
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4860 drawing an image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4861
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4862 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4863 prepare_image_for_display (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4864 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4865 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4866 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4867 EMACS_TIME t;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4868
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4869 /* We're about to display IMG, so set its timestamp to `now'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4870 EMACS_GET_TIME (t);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4871 img->timestamp = EMACS_SECS (t);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4872
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4873 /* If IMG doesn't have a pixmap yet, load it now, using the image
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4874 type dependent loader function. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4875 if (img->pixmap == 0 && !img->load_failed_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4876 img->load_failed_p = img->type->load (f, img) == 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4877 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4878
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4879
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4880 /* Value is the number of pixels for the ascent of image IMG when
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4881 drawn in face FACE. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4882
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4883 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4884 image_ascent (img, face)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4885 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4886 struct face *face;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4887 {
35660
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
4888 int height = img->height + img->vmargin;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4889 int ascent;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4890
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4891 if (img->ascent == CENTERED_IMAGE_ASCENT)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4892 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4893 if (face->font)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4894 ascent = height / 2 - (FONT_DESCENT(face->font)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4895 - FONT_BASE(face->font)) / 2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4896 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4897 ascent = height / 2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4898 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4899 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4900 ascent = height * img->ascent / 100.0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4901
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4902 return ascent;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4903 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4904
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4905
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4906
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4907 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4908 Helper functions for X image types
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4909 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4910
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4911 static void x_clear_image P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4912 static unsigned long x_alloc_image_color P_ ((struct frame *f,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4913 struct image *img,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4914 Lisp_Object color_name,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4915 unsigned long dflt));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4916
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4917 /* Free X resources of image IMG which is used on frame F. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4918
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4919 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4920 x_clear_image (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4921 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4922 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4923 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4924 #if 0 /* MAC_TODO: W32 image support */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4925
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4926 if (img->pixmap)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4927 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4928 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4929 XFreePixmap (NULL, img->pixmap);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4930 img->pixmap = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4931 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4932 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4933
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4934 if (img->ncolors)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4935 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4936 int class = FRAME_W32_DISPLAY_INFO (f)->visual->class;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4937
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4938 /* If display has an immutable color map, freeing colors is not
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4939 necessary and some servers don't allow it. So don't do it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4940 if (class != StaticColor
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4941 && class != StaticGray
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4942 && class != TrueColor)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4943 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4944 Colormap cmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4945 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4946 cmap = DefaultColormapOfScreen (FRAME_W32_DISPLAY_INFO (f)->screen);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4947 XFreeColors (FRAME_W32_DISPLAY (f), cmap, img->colors,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4948 img->ncolors, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4949 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4950 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4951
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4952 xfree (img->colors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4953 img->colors = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4954 img->ncolors = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4955 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4956 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4957 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4958
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4959
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4960 /* Allocate color COLOR_NAME for image IMG on frame F. If color
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4961 cannot be allocated, use DFLT. Add a newly allocated color to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4962 IMG->colors, so that it can be freed again. Value is the pixel
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4963 color. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4964
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4965 static unsigned long
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4966 x_alloc_image_color (f, img, color_name, dflt)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4967 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4968 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4969 Lisp_Object color_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4970 unsigned long dflt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4971 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4972 #if 0 /* MAC_TODO: allocing colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4973 XColor color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4974 unsigned long result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4975
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4976 xassert (STRINGP (color_name));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4977
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4978 if (w32_defined_color (f, XSTRING (color_name)->data, &color, 1))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4979 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4980 /* This isn't called frequently so we get away with simply
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4981 reallocating the color vector to the needed size, here. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4982 ++img->ncolors;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4983 img->colors =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4984 (unsigned long *) xrealloc (img->colors,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4985 img->ncolors * sizeof *img->colors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4986 img->colors[img->ncolors - 1] = color.pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4987 result = color.pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4988 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4989 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4990 result = dflt;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4991 return result;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4992 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4993 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4994 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4995
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4996
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4997
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4998 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
4999 Image Cache
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5000 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5001
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5002 static void cache_image P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5003
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5004
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5005 /* Return a new, initialized image cache that is allocated from the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5006 heap. Call free_image_cache to free an image cache. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5007
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5008 struct image_cache *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5009 make_image_cache ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5010 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5011 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5012 int size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5013
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5014 bzero (c, sizeof *c);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5015 c->size = 50;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5016 c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5017 size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5018 c->buckets = (struct image **) xmalloc (size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5019 bzero (c->buckets, size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5020 return c;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5021 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5022
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5023
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5024 /* Free image cache of frame F. Be aware that X frames share images
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5025 caches. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5026
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5027 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5028 free_image_cache (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5029 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5030 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5031 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5032 if (c)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5033 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5034 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5035
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5036 /* Cache should not be referenced by any frame when freed. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5037 xassert (c->refcount == 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5038
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5039 for (i = 0; i < c->used; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5040 free_image (f, c->images[i]);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5041 xfree (c->images);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5042 xfree (c);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5043 xfree (c->buckets);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5044 FRAME_X_IMAGE_CACHE (f) = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5045 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5046 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5047
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5048
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5049 /* Clear image cache of frame F. FORCE_P non-zero means free all
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5050 images. FORCE_P zero means clear only images that haven't been
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5051 displayed for some time. Should be called from time to time to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5052 reduce the number of loaded images. If image-eviction-seconds is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5053 non-nil, this frees images in the cache which weren't displayed for
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5054 at least that many seconds. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5055
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5056 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5057 clear_image_cache (f, force_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5058 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5059 int force_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5060 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5061 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5062
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5063 if (c && INTEGERP (Vimage_cache_eviction_delay))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5064 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5065 EMACS_TIME t;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5066 unsigned long old;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5067 int i, any_freed_p = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5068
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5069 EMACS_GET_TIME (t);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5070 old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5071
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5072 for (i = 0; i < c->used; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5073 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5074 struct image *img = c->images[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5075 if (img != NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5076 && (force_p
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5077 || (img->timestamp > old)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5078 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5079 free_image (f, img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5080 any_freed_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5081 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5082 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5083
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5084 /* We may be clearing the image cache because, for example,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5085 Emacs was iconified for a longer period of time. In that
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5086 case, current matrices may still contain references to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5087 images freed above. So, clear these matrices. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5088 if (any_freed_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5089 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5090 clear_current_matrices (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5091 ++windows_or_buffers_changed;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5092 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5093 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5094 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5095
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5096
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5097 DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5098 0, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5099 "Clear the image cache of FRAME.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5100 FRAME nil or omitted means use the selected frame.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5101 FRAME t means clear the image caches of all frames.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5102 (frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5103 Lisp_Object frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5104 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5105 if (EQ (frame, Qt))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5106 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5107 Lisp_Object tail;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5108
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5109 FOR_EACH_FRAME (tail, frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5110 if (FRAME_MAC_P (XFRAME (frame)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5111 clear_image_cache (XFRAME (frame), 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5112 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5113 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5114 clear_image_cache (check_x_frame (frame), 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5115
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5116 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5117 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5118
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5119
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5120 /* Return the id of image with Lisp specification SPEC on frame F.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5121 SPEC must be a valid Lisp image specification (see valid_image_p). */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5122
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5123 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5124 lookup_image (f, spec)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5125 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5126 Lisp_Object spec;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5127 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5128 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5129 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5130 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5131 unsigned hash;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5132 struct gcpro gcpro1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5133 EMACS_TIME now;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5134
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5135 /* F must be a window-system frame, and SPEC must be a valid image
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5136 specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5137 xassert (FRAME_WINDOW_P (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5138 xassert (valid_image_p (spec));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5139
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5140 GCPRO1 (spec);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5141
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5142 /* Look up SPEC in the hash table of the image cache. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5143 hash = sxhash (spec, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5144 i = hash % IMAGE_CACHE_BUCKETS_SIZE;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5145
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5146 for (img = c->buckets[i]; img; img = img->next)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5147 if (img->hash == hash && !NILP (Fequal (img->spec, spec)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5148 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5149
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5150 /* If not found, create a new image and cache it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5151 if (img == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5152 {
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
5153 BLOCK_INPUT;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5154 img = make_image (spec, hash);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5155 cache_image (f, img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5156 img->load_failed_p = img->type->load (f, img) == 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5157
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5158 /* If we can't load the image, and we don't have a width and
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5159 height, use some arbitrary width and height so that we can
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5160 draw a rectangle for it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5161 if (img->load_failed_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5162 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5163 Lisp_Object value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5164
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5165 value = image_spec_value (spec, QCwidth, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5166 img->width = (INTEGERP (value)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5167 ? XFASTINT (value) : DEFAULT_IMAGE_WIDTH);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5168 value = image_spec_value (spec, QCheight, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5169 img->height = (INTEGERP (value)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5170 ? XFASTINT (value) : DEFAULT_IMAGE_HEIGHT);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5171 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5172 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5173 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5174 /* Handle image type independent image attributes
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5175 `:ascent PERCENT', `:margin MARGIN', `:relief RELIEF'. */
35660
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5176 Lisp_Object ascent, margin, relief;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5177
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5178 ascent = image_spec_value (spec, QCascent, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5179 if (INTEGERP (ascent))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5180 img->ascent = XFASTINT (ascent);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5181 else if (EQ (ascent, Qcenter))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5182 img->ascent = CENTERED_IMAGE_ASCENT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5183
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5184 margin = image_spec_value (spec, QCmargin, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5185 if (INTEGERP (margin) && XINT (margin) >= 0)
35660
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5186 img->vmargin = img->hmargin = XFASTINT (margin);
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5187 else if (CONSP (margin) && INTEGERP (XCAR (margin))
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5188 && INTEGERP (XCDR (margin)))
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5189 {
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5190 if (XINT (XCAR (margin)) > 0)
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5191 img->hmargin = XFASTINT (XCAR (margin));
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5192 if (XINT (XCDR (margin)) > 0)
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5193 img->vmargin = XFASTINT (XCDR (margin));
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5194 }
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5195
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5196 relief = image_spec_value (spec, QCrelief, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5197 if (INTEGERP (relief))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5198 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5199 img->relief = XINT (relief);
35660
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5200 img->hmargin += abs (img->relief);
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
5201 img->vmargin += abs (img->relief);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5202 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5203 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5204 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5205
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5206 /* We're using IMG, so set its timestamp to `now'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5207 EMACS_GET_TIME (now);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5208 img->timestamp = EMACS_SECS (now);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5209
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5210 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5211
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5212 /* Value is the image id. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5213 return img->id;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5214 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5215
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5216
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5217 /* Cache image IMG in the image cache of frame F. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5218
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5219 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5220 cache_image (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5221 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5222 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5223 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5224 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5225 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5226
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5227 /* Find a free slot in c->images. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5228 for (i = 0; i < c->used; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5229 if (c->images[i] == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5230 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5231
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5232 /* If no free slot found, maybe enlarge c->images. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5233 if (i == c->used && c->used == c->size)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5234 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5235 c->size *= 2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5236 c->images = (struct image **) xrealloc (c->images,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5237 c->size * sizeof *c->images);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5238 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5239
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5240 /* Add IMG to c->images, and assign IMG an id. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5241 c->images[i] = img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5242 img->id = i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5243 if (i == c->used)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5244 ++c->used;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5245
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5246 /* Add IMG to the cache's hash table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5247 i = img->hash % IMAGE_CACHE_BUCKETS_SIZE;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5248 img->next = c->buckets[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5249 if (img->next)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5250 img->next->prev = img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5251 img->prev = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5252 c->buckets[i] = img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5253 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5254
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5255
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5256 /* Call FN on every image in the image cache of frame F. Used to mark
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5257 Lisp Objects in the image cache. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5258
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5259 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5260 forall_images_in_image_cache (f, fn)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5261 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5262 void (*fn) P_ ((struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5263 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5264 if (FRAME_LIVE_P (f) && FRAME_MAC_P (f))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5265 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5266 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5267 if (c)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5268 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5269 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5270 for (i = 0; i < c->used; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5271 if (c->images[i])
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5272 fn (c->images[i]);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5273 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5274 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5275 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5276
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5277
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5278
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5279 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5280 Mac support code
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5281 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5282
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5283 #if 0 /* MAC_TODO: Mac specific image code. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5284
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5285 static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5286 XImage **, Pixmap *));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5287 static void x_destroy_x_image P_ ((XImage *));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5288 static void x_put_x_image P_ ((struct frame *, XImage *, Pixmap, int, int));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5289
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5290
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5291 /* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5292 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5293 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5294 via xmalloc. Print error messages via image_error if an error
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5295 occurs. Value is non-zero if successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5296
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5297 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5298 x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5299 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5300 int width, height, depth;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5301 XImage **ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5302 Pixmap *pixmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5303 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5304 #if 0 /* MAC_TODO: Image support for Mac */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5305 Display *display = FRAME_W32_DISPLAY (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5306 Screen *screen = FRAME_X_SCREEN (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5307 Window window = FRAME_W32_WINDOW (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5308
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5309 xassert (interrupt_input_blocked);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5310
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5311 if (depth <= 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5312 depth = DefaultDepthOfScreen (screen);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5313 *ximg = XCreateImage (display, DefaultVisualOfScreen (screen),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5314 depth, ZPixmap, 0, NULL, width, height,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5315 depth > 16 ? 32 : depth > 8 ? 16 : 8, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5316 if (*ximg == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5317 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5318 image_error ("Unable to allocate X image", Qnil, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5319 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5320 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5321
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5322 /* Allocate image raster. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5323 (*ximg)->data = (char *) xmalloc ((*ximg)->bytes_per_line * height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5324
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5325 /* Allocate a pixmap of the same size. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5326 *pixmap = XCreatePixmap (display, window, width, height, depth);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5327 if (*pixmap == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5328 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5329 x_destroy_x_image (*ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5330 *ximg = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5331 image_error ("Unable to create X pixmap", Qnil, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5332 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5333 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5334 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5335 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5336 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5337
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5338
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5339 /* Destroy XImage XIMG. Free XIMG->data. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5340
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5341 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5342 x_destroy_x_image (ximg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5343 XImage *ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5344 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5345 xassert (interrupt_input_blocked);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5346 if (ximg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5347 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5348 xfree (ximg->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5349 ximg->data = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5350 XDestroyImage (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5351 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5352 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5353
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5354
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5355 /* Put XImage XIMG into pixmap PIXMAP on frame F. WIDTH and HEIGHT
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5356 are width and height of both the image and pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5357
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5358 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5359 x_put_x_image (f, ximg, pixmap, width, height)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5360 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5361 XImage *ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5362 Pixmap pixmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5363 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5364 GC gc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5365
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5366 xassert (interrupt_input_blocked);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5367 gc = XCreateGC (NULL, pixmap, 0, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5368 XPutImage (NULL, pixmap, gc, ximg, 0, 0, 0, 0, width, height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5369 XFreeGC (NULL, gc);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5370 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5371
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5372 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5373
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5374
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5375 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5376 Searching files
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5377 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5378
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5379 static Lisp_Object x_find_image_file P_ ((Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5380
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5381 /* Find image file FILE. Look in data-directory, then
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5382 x-bitmap-file-path. Value is the full name of the file found, or
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5383 nil if not found. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5384
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5385 static Lisp_Object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5386 x_find_image_file (file)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5387 Lisp_Object file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5388 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5389 Lisp_Object file_found, search_path;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5390 struct gcpro gcpro1, gcpro2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5391 int fd;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5392
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5393 file_found = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5394 search_path = Fcons (Vdata_directory, Vx_bitmap_file_path);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5395 GCPRO2 (file_found, search_path);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5396
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5397 /* Try to find FILE in data-directory, then x-bitmap-file-path. */
39812
66e0816837a8 Update calls to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 36417
diff changeset
5398 fd = openp (search_path, file, Qnil, &file_found, 0);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5399
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5400 if (fd < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5401 file_found = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5402 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5403 close (fd);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5404
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5405 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5406 return file_found;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5407 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5408
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5409
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5410 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5411 XBM images
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5412 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5413
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5414 static int xbm_load P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5415 static int xbm_load_image_from_file P_ ((struct frame *f, struct image *img,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5416 Lisp_Object file));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5417 static int xbm_image_p P_ ((Lisp_Object object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5418 static int xbm_read_bitmap_file_data P_ ((char *, int *, int *,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5419 unsigned char **));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5420
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5421
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5422 /* Indices of image specification fields in xbm_format, below. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5423
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5424 enum xbm_keyword_index
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5425 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5426 XBM_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5427 XBM_FILE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5428 XBM_WIDTH,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5429 XBM_HEIGHT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5430 XBM_DATA,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5431 XBM_FOREGROUND,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5432 XBM_BACKGROUND,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5433 XBM_ASCENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5434 XBM_MARGIN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5435 XBM_RELIEF,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5436 XBM_ALGORITHM,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5437 XBM_HEURISTIC_MASK,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5438 XBM_LAST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5439 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5440
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5441 /* Vector of image_keyword structures describing the format
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5442 of valid XBM image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5443
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5444 static struct image_keyword xbm_format[XBM_LAST] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5445 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5446 {":type", IMAGE_SYMBOL_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5447 {":file", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5448 {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5449 {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5450 {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5451 {":foreground", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5452 {":background", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5453 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
5454 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5455 {":relief", IMAGE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
5456 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5457 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5458 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5459
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5460 /* Structure describing the image type XBM. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5461
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5462 static struct image_type xbm_type =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5463 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5464 &Qxbm,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5465 xbm_image_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5466 xbm_load,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5467 x_clear_image,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5468 NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5469 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5470
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5471 /* Tokens returned from xbm_scan. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5472
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5473 enum xbm_token
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5474 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5475 XBM_TK_IDENT = 256,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5476 XBM_TK_NUMBER
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5477 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5478
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5479
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5480 /* Return non-zero if OBJECT is a valid XBM-type image specification.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5481 A valid specification is a list starting with the symbol `image'
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5482 The rest of the list is a property list which must contain an
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5483 entry `:type xbm..
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5484
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5485 If the specification specifies a file to load, it must contain
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5486 an entry `:file FILENAME' where FILENAME is a string.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5487
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5488 If the specification is for a bitmap loaded from memory it must
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5489 contain `:width WIDTH', `:height HEIGHT', and `:data DATA', where
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5490 WIDTH and HEIGHT are integers > 0. DATA may be:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5491
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5492 1. a string large enough to hold the bitmap data, i.e. it must
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5493 have a size >= (WIDTH + 7) / 8 * HEIGHT
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5494
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5495 2. a bool-vector of size >= WIDTH * HEIGHT
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5496
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5497 3. a vector of strings or bool-vectors, one for each line of the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5498 bitmap.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5499
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5500 Both the file and data forms may contain the additional entries
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5501 `:background COLOR' and `:foreground COLOR'. If not present,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5502 foreground and background of the frame on which the image is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5503 displayed, is used. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5504
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5505 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5506 xbm_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5507 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5508 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5509 struct image_keyword kw[XBM_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5510
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5511 bcopy (xbm_format, kw, sizeof kw);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5512 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5513 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5514
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5515 xassert (EQ (kw[XBM_TYPE].value, Qxbm));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5516
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5517 if (kw[XBM_FILE].count)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5518 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5519 if (kw[XBM_WIDTH].count || kw[XBM_HEIGHT].count || kw[XBM_DATA].count)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5520 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5521 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5522 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5523 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5524 Lisp_Object data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5525 int width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5526
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5527 /* Entries for `:width', `:height' and `:data' must be present. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5528 if (!kw[XBM_WIDTH].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5529 || !kw[XBM_HEIGHT].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5530 || !kw[XBM_DATA].count)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5531 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5532
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5533 data = kw[XBM_DATA].value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5534 width = XFASTINT (kw[XBM_WIDTH].value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5535 height = XFASTINT (kw[XBM_HEIGHT].value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5536
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5537 /* Check type of data, and width and height against contents of
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5538 data. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5539 if (VECTORP (data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5540 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5541 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5542
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5543 /* Number of elements of the vector must be >= height. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5544 if (XVECTOR (data)->size < height)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5545 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5546
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5547 /* Each string or bool-vector in data must be large enough
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5548 for one line of the image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5549 for (i = 0; i < height; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5550 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5551 Lisp_Object elt = XVECTOR (data)->contents[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5552
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5553 if (STRINGP (elt))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5554 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5555 if (XSTRING (elt)->size
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5556 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5557 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5558 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5559 else if (BOOL_VECTOR_P (elt))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5560 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5561 if (XBOOL_VECTOR (elt)->size < width)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5562 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5563 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5564 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5565 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5566 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5567 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5568 else if (STRINGP (data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5569 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5570 if (XSTRING (data)->size
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5571 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5572 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5573 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5574 else if (BOOL_VECTOR_P (data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5575 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5576 if (XBOOL_VECTOR (data)->size < width * height)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5577 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5578 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5579 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5580 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5581 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5582
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5583 /* Baseline must be a value between 0 and 100 (a percentage). */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5584 if (kw[XBM_ASCENT].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5585 && XFASTINT (kw[XBM_ASCENT].value) > 100)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5586 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5587
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5588 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5589 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5590
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5591
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5592 /* Scan a bitmap file. FP is the stream to read from. Value is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5593 either an enumerator from enum xbm_token, or a character for a
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5594 single-character token, or 0 at end of file. If scanning an
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5595 identifier, store the lexeme of the identifier in SVAL. If
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5596 scanning a number, store its value in *IVAL. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5597
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5598 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5599 xbm_scan (fp, sval, ival)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5600 FILE *fp;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5601 char *sval;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5602 int *ival;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5603 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5604 int c;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5605
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5606 /* Skip white space. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5607 while ((c = fgetc (fp)) != EOF && isspace (c))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5608 ;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5609
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5610 if (c == EOF)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5611 c = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5612 else if (isdigit (c))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5613 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5614 int value = 0, digit;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5615
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5616 if (c == '0')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5617 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5618 c = fgetc (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5619 if (c == 'x' || c == 'X')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5620 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5621 while ((c = fgetc (fp)) != EOF)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5622 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5623 if (isdigit (c))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5624 digit = c - '0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5625 else if (c >= 'a' && c <= 'f')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5626 digit = c - 'a' + 10;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5627 else if (c >= 'A' && c <= 'F')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5628 digit = c - 'A' + 10;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5629 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5630 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5631 value = 16 * value + digit;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5632 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5633 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5634 else if (isdigit (c))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5635 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5636 value = c - '0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5637 while ((c = fgetc (fp)) != EOF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5638 && isdigit (c))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5639 value = 8 * value + c - '0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5640 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5641 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5642 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5643 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5644 value = c - '0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5645 while ((c = fgetc (fp)) != EOF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5646 && isdigit (c))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5647 value = 10 * value + c - '0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5648 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5649
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5650 if (c != EOF)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5651 ungetc (c, fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5652 *ival = value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5653 c = XBM_TK_NUMBER;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5654 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5655 else if (isalpha (c) || c == '_')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5656 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5657 *sval++ = c;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5658 while ((c = fgetc (fp)) != EOF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5659 && (isalnum (c) || c == '_'))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5660 *sval++ = c;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5661 *sval = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5662 if (c != EOF)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5663 ungetc (c, fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5664 c = XBM_TK_IDENT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5665 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5666
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5667 return c;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5668 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5669
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5670
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5671 /* Replacement for XReadBitmapFileData which isn't available under old
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5672 X versions. FILE is the name of the bitmap file to read. Set
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5673 *WIDTH and *HEIGHT to the width and height of the image. Return in
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5674 *DATA the bitmap data allocated with xmalloc. Value is non-zero if
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5675 successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5676
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5677 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5678 xbm_read_bitmap_file_data (file, width, height, data)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5679 char *file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5680 int *width, *height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5681 unsigned char **data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5682 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5683 FILE *fp;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5684 char buffer[BUFSIZ];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5685 int padding_p = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5686 int v10 = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5687 int bytes_per_line, i, nbytes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5688 unsigned char *p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5689 int value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5690 int LA1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5691
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5692 #define match() \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5693 LA1 = xbm_scan (fp, buffer, &value)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5694
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5695 #define expect(TOKEN) \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5696 if (LA1 != (TOKEN)) \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5697 goto failure; \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5698 else \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5699 match ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5700
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5701 #define expect_ident(IDENT) \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5702 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5703 match (); \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5704 else \
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5705 goto failure
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5706
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5707 fp = fopen (file, "r");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5708 if (fp == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5709 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5710
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5711 *width = *height = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5712 *data = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5713 LA1 = xbm_scan (fp, buffer, &value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5714
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5715 /* Parse defines for width, height and hot-spots. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5716 while (LA1 == '#')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5717 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5718 match ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5719 expect_ident ("define");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5720 expect (XBM_TK_IDENT);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5721
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5722 if (LA1 == XBM_TK_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5723 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5724 char *p = strrchr (buffer, '_');
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5725 p = p ? p + 1 : buffer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5726 if (strcmp (p, "width") == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5727 *width = value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5728 else if (strcmp (p, "height") == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5729 *height = value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5730 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5731 expect (XBM_TK_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5732 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5733
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5734 if (*width < 0 || *height < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5735 goto failure;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5736
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5737 /* Parse bits. Must start with `static'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5738 expect_ident ("static");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5739 if (LA1 == XBM_TK_IDENT)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5740 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5741 if (strcmp (buffer, "unsigned") == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5742 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5743 match ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5744 expect_ident ("char");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5745 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5746 else if (strcmp (buffer, "short") == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5747 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5748 match ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5749 v10 = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5750 if (*width % 16 && *width % 16 < 9)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5751 padding_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5752 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5753 else if (strcmp (buffer, "char") == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5754 match ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5755 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5756 goto failure;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5757 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5758 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5759 goto failure;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5760
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5761 expect (XBM_TK_IDENT);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5762 expect ('[');
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5763 expect (']');
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5764 expect ('=');
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5765 expect ('{');
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5766
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5767 bytes_per_line = (*width + 7) / 8 + padding_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5768 nbytes = bytes_per_line * *height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5769 p = *data = (char *) xmalloc (nbytes);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5770
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5771 if (v10)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5772 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5773
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5774 for (i = 0; i < nbytes; i += 2)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5775 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5776 int val = value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5777 expect (XBM_TK_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5778
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5779 *p++ = val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5780 if (!padding_p || ((i + 2) % bytes_per_line))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5781 *p++ = value >> 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5782
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5783 if (LA1 == ',' || LA1 == '}')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5784 match ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5785 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5786 goto failure;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5787 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5788 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5789 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5790 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5791 for (i = 0; i < nbytes; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5792 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5793 int val = value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5794 expect (XBM_TK_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5795
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5796 *p++ = val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5797
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5798 if (LA1 == ',' || LA1 == '}')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5799 match ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5800 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5801 goto failure;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5802 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5803 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5804
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5805 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5806 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5807
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5808 failure:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5809
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5810 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5811 if (*data)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5812 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5813 xfree (*data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5814 *data = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5815 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5816 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5817
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5818 #undef match
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5819 #undef expect
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5820 #undef expect_ident
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5821 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5822
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5823
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5824 /* Load XBM image IMG which will be displayed on frame F from file
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5825 SPECIFIED_FILE. Value is non-zero if successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5826
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5827 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5828 xbm_load_image_from_file (f, img, specified_file)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5829 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5830 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5831 Lisp_Object specified_file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5832 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5833 int rc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5834 unsigned char *data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5835 int success_p = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5836 Lisp_Object file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5837 struct gcpro gcpro1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5838
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5839 xassert (STRINGP (specified_file));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5840 file = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5841 GCPRO1 (file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5842
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5843 file = x_find_image_file (specified_file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5844 if (!STRINGP (file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5845 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5846 image_error ("Cannot find image file `%s'", specified_file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5847 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5848 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5849 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5850
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5851 rc = xbm_read_bitmap_file_data (XSTRING (file)->data, &img->width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5852 &img->height, &data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5853 if (rc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5854 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5855 int depth = one_mac_display_info.n_cbits;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5856 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5857 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5858 Lisp_Object value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5859
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5860 xassert (img->width > 0 && img->height > 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5861
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5862 /* Get foreground and background colors, maybe allocate colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5863 value = image_spec_value (img->spec, QCforeground, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5864 if (!NILP (value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5865 foreground = x_alloc_image_color (f, img, value, foreground);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5866
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5867 value = image_spec_value (img->spec, QCbackground, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5868 if (!NILP (value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5869 background = x_alloc_image_color (f, img, value, background);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5870
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5871 #if 0 /* MAC_TODO : Port image display to Mac */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5872 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5873 img->pixmap
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5874 = XCreatePixmapFromBitmapData (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5875 FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5876 data,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5877 img->width, img->height,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5878 foreground, background,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5879 depth);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5880 xfree (data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5881
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5882 if (img->pixmap == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5883 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5884 x_clear_image (f, img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5885 image_error ("Unable to create X pixmap for `%s'", file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5886 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5887 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5888 success_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5889
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5890 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5891 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5892 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5893 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5894 image_error ("Error loading XBM image `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5895
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5896 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5897 return success_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5898 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5899
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5900
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5901 /* Fill image IMG which is used on frame F with pixmap data. Value is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5902 non-zero if successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5903
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5904 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5905 xbm_load (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5906 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5907 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5908 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5909 int success_p = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5910 Lisp_Object file_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5911
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5912 xassert (xbm_image_p (img->spec));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5913
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5914 /* If IMG->spec specifies a file name, create a non-file spec from it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5915 file_name = image_spec_value (img->spec, QCfile, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5916 if (STRINGP (file_name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5917 success_p = xbm_load_image_from_file (f, img, file_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5918 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5919 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5920 struct image_keyword fmt[XBM_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5921 Lisp_Object data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5922 int depth;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5923 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5924 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5925 char *bits;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5926 int parsed_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5927
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5928 /* Parse the list specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5929 bcopy (xbm_format, fmt, sizeof fmt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5930 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5931 xassert (parsed_p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5932
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5933 /* Get specified width, and height. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5934 img->width = XFASTINT (fmt[XBM_WIDTH].value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5935 img->height = XFASTINT (fmt[XBM_HEIGHT].value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5936 xassert (img->width > 0 && img->height > 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5937
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5938 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5939
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5940 if (fmt[XBM_ASCENT].count)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5941 img->ascent = XFASTINT (fmt[XBM_ASCENT].value);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5942
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5943 /* Get foreground and background colors, maybe allocate colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5944 if (fmt[XBM_FOREGROUND].count)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5945 foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5946 foreground);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5947 if (fmt[XBM_BACKGROUND].count)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5948 background = x_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5949 background);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5950
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5951 /* Set bits to the bitmap image data. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5952 data = fmt[XBM_DATA].value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5953 if (VECTORP (data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5954 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5955 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5956 char *p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5957 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5958
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5959 p = bits = (char *) alloca (nbytes * img->height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5960 for (i = 0; i < img->height; ++i, p += nbytes)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5961 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5962 Lisp_Object line = XVECTOR (data)->contents[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5963 if (STRINGP (line))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5964 bcopy (XSTRING (line)->data, p, nbytes);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5965 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5966 bcopy (XBOOL_VECTOR (line)->data, p, nbytes);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5967 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5968 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5969 else if (STRINGP (data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5970 bits = XSTRING (data)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5971 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5972 bits = XBOOL_VECTOR (data)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5973
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5974 #if 0 /* MAC_TODO : port Mac display code */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5975 /* Create the pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5976 depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5977 img->pixmap
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5978 = XCreatePixmapFromBitmapData (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5979 FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5980 bits,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5981 img->width, img->height,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5982 foreground, background,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5983 depth);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5984 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5985
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5986 if (img->pixmap)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5987 success_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5988 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5989 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5990 image_error ("Unable to create pixmap for XBM image `%s'",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5991 img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5992 x_clear_image (f, img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5993 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5994
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5995 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5996 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5997
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5998 return success_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
5999 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6000
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6001
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6002
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6003 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6004 XPM images
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6005 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6006
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6007 #if HAVE_XPM
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6008
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6009 static int xpm_image_p P_ ((Lisp_Object object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6010 static int xpm_load P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6011 static int xpm_valid_color_symbols_p P_ ((Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6012
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6013 #include "X11/xpm.h"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6014
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6015 /* The symbol `xpm' identifying XPM-format images. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6016
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6017 Lisp_Object Qxpm;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6018
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6019 /* Indices of image specification fields in xpm_format, below. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6020
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6021 enum xpm_keyword_index
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6022 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6023 XPM_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6024 XPM_FILE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6025 XPM_DATA,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6026 XPM_ASCENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6027 XPM_MARGIN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6028 XPM_RELIEF,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6029 XPM_ALGORITHM,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6030 XPM_HEURISTIC_MASK,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6031 XPM_COLOR_SYMBOLS,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6032 XPM_LAST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6033 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6034
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6035 /* Vector of image_keyword structures describing the format
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6036 of valid XPM image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6037
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6038 static struct image_keyword xpm_format[XPM_LAST] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6039 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6040 {":type", IMAGE_SYMBOL_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6041 {":file", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6042 {":data", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6043 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
6044 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6045 {":relief", IMAGE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
6046 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6047 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6048 {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6049 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6050
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6051 /* Structure describing the image type XBM. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6052
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6053 static struct image_type xpm_type =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6054 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6055 &Qxpm,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6056 xpm_image_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6057 xpm_load,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6058 x_clear_image,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6059 NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6060 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6061
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6062
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6063 /* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6064 for XPM images. Such a list must consist of conses whose car and
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6065 cdr are strings. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6066
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6067 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6068 xpm_valid_color_symbols_p (color_symbols)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6069 Lisp_Object color_symbols;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6070 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6071 while (CONSP (color_symbols))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6072 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6073 Lisp_Object sym = XCAR (color_symbols);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6074 if (!CONSP (sym)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6075 || !STRINGP (XCAR (sym))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6076 || !STRINGP (XCDR (sym)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6077 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6078 color_symbols = XCDR (color_symbols);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6079 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6080
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6081 return NILP (color_symbols);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6082 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6083
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6084
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6085 /* Value is non-zero if OBJECT is a valid XPM image specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6086
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6087 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6088 xpm_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6089 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6090 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6091 struct image_keyword fmt[XPM_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6092 bcopy (xpm_format, fmt, sizeof fmt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6093 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6094 /* Either `:file' or `:data' must be present. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6095 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6096 /* Either no `:color-symbols' or it's a list of conses
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6097 whose car and cdr are strings. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6098 && (fmt[XPM_COLOR_SYMBOLS].count == 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6099 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6100 && (fmt[XPM_ASCENT].count == 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6101 || XFASTINT (fmt[XPM_ASCENT].value) < 100));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6102 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6103
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6104
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6105 /* Load image IMG which will be displayed on frame F. Value is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6106 non-zero if successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6107
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6108 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6109 xpm_load (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6110 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6111 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6112 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6113 int rc, i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6114 XpmAttributes attrs;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6115 Lisp_Object specified_file, color_symbols;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6116
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6117 /* Configure the XPM lib. Use the visual of frame F. Allocate
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6118 close colors. Return colors allocated. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6119 bzero (&attrs, sizeof attrs);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6120 attrs.visual = FRAME_X_VISUAL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6121 attrs.colormap = FRAME_X_COLORMAP (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6122 attrs.valuemask |= XpmVisual;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6123 attrs.valuemask |= XpmColormap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6124 attrs.valuemask |= XpmReturnAllocPixels;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6125 #ifdef XpmAllocCloseColors
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6126 attrs.alloc_close_colors = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6127 attrs.valuemask |= XpmAllocCloseColors;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6128 #else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6129 attrs.closeness = 600;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6130 attrs.valuemask |= XpmCloseness;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6131 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6132
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6133 /* If image specification contains symbolic color definitions, add
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6134 these to `attrs'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6135 color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6136 if (CONSP (color_symbols))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6137 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6138 Lisp_Object tail;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6139 XpmColorSymbol *xpm_syms;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6140 int i, size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6141
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6142 attrs.valuemask |= XpmColorSymbols;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6143
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6144 /* Count number of symbols. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6145 attrs.numsymbols = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6146 for (tail = color_symbols; CONSP (tail); tail = XCDR (tail))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6147 ++attrs.numsymbols;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6148
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6149 /* Allocate an XpmColorSymbol array. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6150 size = attrs.numsymbols * sizeof *xpm_syms;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6151 xpm_syms = (XpmColorSymbol *) alloca (size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6152 bzero (xpm_syms, size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6153 attrs.colorsymbols = xpm_syms;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6154
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6155 /* Fill the color symbol array. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6156 for (tail = color_symbols, i = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6157 CONSP (tail);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6158 ++i, tail = XCDR (tail))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6159 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6160 Lisp_Object name = XCAR (XCAR (tail));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6161 Lisp_Object color = XCDR (XCAR (tail));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6162 xpm_syms[i].name = (char *) alloca (XSTRING (name)->size + 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6163 strcpy (xpm_syms[i].name, XSTRING (name)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6164 xpm_syms[i].value = (char *) alloca (XSTRING (color)->size + 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6165 strcpy (xpm_syms[i].value, XSTRING (color)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6166 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6167 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6168
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6169 /* Create a pixmap for the image, either from a file, or from a
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6170 string buffer containing data in the same format as an XPM file. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6171 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6172 specified_file = image_spec_value (img->spec, QCfile, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6173 if (STRINGP (specified_file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6174 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6175 Lisp_Object file = x_find_image_file (specified_file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6176 if (!STRINGP (file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6177 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6178 image_error ("Cannot find image file `%s'", specified_file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6179 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6180 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6181 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6182
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6183 rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6184 XSTRING (file)->data, &img->pixmap, &img->mask,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6185 &attrs);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6186 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6187 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6188 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6189 Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6190 rc = XpmCreatePixmapFromBuffer (NULL, FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6191 XSTRING (buffer)->data,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6192 &img->pixmap, &img->mask,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6193 &attrs);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6194 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6195 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6196
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6197 if (rc == XpmSuccess)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6198 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6199 /* Remember allocated colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6200 img->ncolors = attrs.nalloc_pixels;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6201 img->colors = (unsigned long *) xmalloc (img->ncolors
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6202 * sizeof *img->colors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6203 for (i = 0; i < attrs.nalloc_pixels; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6204 img->colors[i] = attrs.alloc_pixels[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6205
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6206 img->width = attrs.width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6207 img->height = attrs.height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6208 xassert (img->width > 0 && img->height > 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6209
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6210 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6211 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6212 XpmFreeAttributes (&attrs);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6213 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6214 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6215 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6216 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6217 switch (rc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6218 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6219 case XpmOpenFailed:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6220 image_error ("Error opening XPM file (%s)", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6221 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6222
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6223 case XpmFileInvalid:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6224 image_error ("Invalid XPM file (%s)", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6225 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6226
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6227 case XpmNoMemory:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6228 image_error ("Out of memory (%s)", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6229 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6230
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6231 case XpmColorFailed:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6232 image_error ("Color allocation error (%s)", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6233 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6234
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6235 default:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6236 image_error ("Unknown error (%s)", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6237 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6238 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6239 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6240
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6241 return rc == XpmSuccess;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6242 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6243
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6244 #endif /* HAVE_XPM != 0 */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6245
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6246
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6247 #if 0 /* MAC_TODO : Color tables on Mac. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6248 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6249 Color table
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6250 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6251
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6252 /* An entry in the color table mapping an RGB color to a pixel color. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6253
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6254 struct ct_color
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6255 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6256 int r, g, b;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6257 unsigned long pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6258
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6259 /* Next in color table collision list. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6260 struct ct_color *next;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6261 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6262
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6263 /* The bucket vector size to use. Must be prime. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6264
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6265 #define CT_SIZE 101
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6266
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6267 /* Value is a hash of the RGB color given by R, G, and B. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6268
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6269 #define CT_HASH_RGB(R, G, B) (((R) << 16) ^ ((G) << 8) ^ (B))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6270
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6271 /* The color hash table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6272
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6273 struct ct_color **ct_table;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6274
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6275 /* Number of entries in the color table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6276
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6277 int ct_colors_allocated;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6278
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6279 /* Function prototypes. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6280
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6281 static void init_color_table P_ ((void));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6282 static void free_color_table P_ ((void));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6283 static unsigned long *colors_in_color_table P_ ((int *n));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6284 static unsigned long lookup_rgb_color P_ ((struct frame *f, int r, int g, int b));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6285 static unsigned long lookup_pixel_color P_ ((struct frame *f, unsigned long p));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6286
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6287
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6288 /* Initialize the color table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6289
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6290 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6291 init_color_table ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6292 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6293 int size = CT_SIZE * sizeof (*ct_table);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6294 ct_table = (struct ct_color **) xmalloc (size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6295 bzero (ct_table, size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6296 ct_colors_allocated = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6297 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6298
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6299
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6300 /* Free memory associated with the color table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6301
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6302 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6303 free_color_table ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6304 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6305 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6306 struct ct_color *p, *next;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6307
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6308 for (i = 0; i < CT_SIZE; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6309 for (p = ct_table[i]; p; p = next)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6310 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6311 next = p->next;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6312 xfree (p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6313 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6314
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6315 xfree (ct_table);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6316 ct_table = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6317 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6318
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6319
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6320 /* Value is a pixel color for RGB color R, G, B on frame F. If an
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6321 entry for that color already is in the color table, return the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6322 pixel color of that entry. Otherwise, allocate a new color for R,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6323 G, B, and make an entry in the color table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6324
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6325 static unsigned long
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6326 lookup_rgb_color (f, r, g, b)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6327 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6328 int r, g, b;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6329 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6330 unsigned hash = CT_HASH_RGB (r, g, b);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6331 int i = hash % CT_SIZE;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6332 struct ct_color *p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6333
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6334 for (p = ct_table[i]; p; p = p->next)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6335 if (p->r == r && p->g == g && p->b == b)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6336 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6337
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6338 if (p == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6339 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6340 COLORREF color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6341 Colormap cmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6342 int rc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6343
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6344 color = RGB_TO_ULONG (r, g, b);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6345
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6346 ++ct_colors_allocated;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6347
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6348 p = (struct ct_color *) xmalloc (sizeof *p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6349 p->r = r;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6350 p->g = g;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6351 p->b = b;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6352 p->pixel = color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6353 p->next = ct_table[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6354 ct_table[i] = p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6355 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6356
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6357 return p->pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6358 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6359
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6360
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6361 /* Look up pixel color PIXEL which is used on frame F in the color
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6362 table. If not already present, allocate it. Value is PIXEL. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6363
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6364 static unsigned long
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6365 lookup_pixel_color (f, pixel)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6366 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6367 unsigned long pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6368 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6369 int i = pixel % CT_SIZE;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6370 struct ct_color *p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6371
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6372 for (p = ct_table[i]; p; p = p->next)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6373 if (p->pixel == pixel)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6374 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6375
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6376 if (p == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6377 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6378 XColor color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6379 Colormap cmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6380 int rc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6381
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6382 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6383
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6384 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6385 color.pixel = pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6386 XQueryColor (NULL, cmap, &color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6387 rc = x_alloc_nearest_color (f, cmap, &color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6388 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6389
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6390 if (rc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6391 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6392 ++ct_colors_allocated;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6393
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6394 p = (struct ct_color *) xmalloc (sizeof *p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6395 p->r = color.red;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6396 p->g = color.green;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6397 p->b = color.blue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6398 p->pixel = pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6399 p->next = ct_table[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6400 ct_table[i] = p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6401 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6402 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6403 return FRAME_FOREGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6404 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6405 return p->pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6406 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6407
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6408
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6409 /* Value is a vector of all pixel colors contained in the color table,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6410 allocated via xmalloc. Set *N to the number of colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6411
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6412 static unsigned long *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6413 colors_in_color_table (n)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6414 int *n;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6415 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6416 int i, j;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6417 struct ct_color *p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6418 unsigned long *colors;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6419
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6420 if (ct_colors_allocated == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6421 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6422 *n = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6423 colors = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6424 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6425 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6426 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6427 colors = (unsigned long *) xmalloc (ct_colors_allocated
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6428 * sizeof *colors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6429 *n = ct_colors_allocated;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6430
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6431 for (i = j = 0; i < CT_SIZE; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6432 for (p = ct_table[i]; p; p = p->next)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6433 colors[j++] = p->pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6434 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6435
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6436 return colors;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6437 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6438
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6439 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6440
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6441
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6442 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6443 Algorithms
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6444 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6445
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6446 #if 0 /* MAC_TODO : Mac versions of low level algorithms */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6447 static void x_laplace_write_row P_ ((struct frame *, long *,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6448 int, XImage *, int));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6449 static void x_laplace_read_row P_ ((struct frame *, Colormap,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6450 XColor *, int, XImage *, int));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6451
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6452
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6453 /* Fill COLORS with RGB colors from row Y of image XIMG. F is the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6454 frame we operate on, CMAP is the color-map in effect, and WIDTH is
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6455 the width of one row in the image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6456
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6457 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6458 x_laplace_read_row (f, cmap, colors, width, ximg, y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6459 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6460 Colormap cmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6461 XColor *colors;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6462 int width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6463 XImage *ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6464 int y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6465 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6466 int x;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6467
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6468 for (x = 0; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6469 colors[x].pixel = XGetPixel (ximg, x, y);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6470
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6471 XQueryColors (NULL, cmap, colors, width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6472 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6473
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6474
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6475 /* Write row Y of image XIMG. PIXELS is an array of WIDTH longs
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6476 containing the pixel colors to write. F is the frame we are
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6477 working on. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6478
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6479 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6480 x_laplace_write_row (f, pixels, width, ximg, y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6481 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6482 long *pixels;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6483 int width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6484 XImage *ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6485 int y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6486 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6487 int x;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6488
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6489 for (x = 0; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6490 XPutPixel (ximg, x, y, pixels[x]);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6491 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6492 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6493
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6494 /* Transform image IMG which is used on frame F with a Laplace
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6495 edge-detection algorithm. The result is an image that can be used
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6496 to draw disabled buttons, for example. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6497
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6498 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6499 x_laplace (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6500 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6501 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6502 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6503 #if 0 /* MAC_TODO : Mac version */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6504 Colormap cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6505 XImage *ximg, *oimg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6506 XColor *in[3];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6507 long *out;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6508 Pixmap pixmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6509 int x, y, i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6510 long pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6511 int in_y, out_y, rc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6512 int mv2 = 45000;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6513
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6514 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6515
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6516 /* Get the X image IMG->pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6517 ximg = XGetImage (NULL, img->pixmap,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6518 0, 0, img->width, img->height, ~0, ZPixmap);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6519
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6520 /* Allocate 3 input rows, and one output row of colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6521 for (i = 0; i < 3; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6522 in[i] = (XColor *) alloca (img->width * sizeof (XColor));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6523 out = (long *) alloca (img->width * sizeof (long));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6524
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6525 /* Create an X image for output. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6526 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6527 &oimg, &pixmap);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6528
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6529 /* Fill first two rows. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6530 x_laplace_read_row (f, cmap, in[0], img->width, ximg, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6531 x_laplace_read_row (f, cmap, in[1], img->width, ximg, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6532 in_y = 2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6533
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6534 /* Write first row, all zeros. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6535 init_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6536 pixel = lookup_rgb_color (f, 0, 0, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6537 for (x = 0; x < img->width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6538 out[x] = pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6539 x_laplace_write_row (f, out, img->width, oimg, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6540 out_y = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6541
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6542 for (y = 2; y < img->height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6543 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6544 int rowa = y % 3;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6545 int rowb = (y + 2) % 3;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6546
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6547 x_laplace_read_row (f, cmap, in[rowa], img->width, ximg, in_y++);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6548
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6549 for (x = 0; x < img->width - 2; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6550 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6551 int r = in[rowa][x].red + mv2 - in[rowb][x + 2].red;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6552 int g = in[rowa][x].green + mv2 - in[rowb][x + 2].green;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6553 int b = in[rowa][x].blue + mv2 - in[rowb][x + 2].blue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6554
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6555 out[x + 1] = lookup_rgb_color (f, r & 0xffff, g & 0xffff,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6556 b & 0xffff);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6557 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6558
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6559 x_laplace_write_row (f, out, img->width, oimg, out_y++);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6560 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6561
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6562 /* Write last line, all zeros. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6563 for (x = 0; x < img->width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6564 out[x] = pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6565 x_laplace_write_row (f, out, img->width, oimg, out_y);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6566
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6567 /* Free the input image, and free resources of IMG. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6568 XDestroyImage (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6569 x_clear_image (f, img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6570
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6571 /* Put the output image into pixmap, and destroy it. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6572 x_put_x_image (f, oimg, pixmap, img->width, img->height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6573 x_destroy_x_image (oimg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6574
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6575 /* Remember new pixmap and colors in IMG. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6576 img->pixmap = pixmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6577 img->colors = colors_in_color_table (&img->ncolors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6578 free_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6579
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6580 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6581 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6582 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6583
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6584
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6585 /* Build a mask for image IMG which is used on frame F. FILE is the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6586 name of an image file, for error messages. HOW determines how to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6587 determine the background color of IMG. If it is a list '(R G B)',
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6588 with R, G, and B being integers >= 0, take that as the color of the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6589 background. Otherwise, determine the background color of IMG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6590 heuristically. Value is non-zero if successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6591
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6592 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6593 x_build_heuristic_mask (f, img, how)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6594 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6595 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6596 Lisp_Object how;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6597 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6598 #if 0 /* MAC_TODO : Mac version */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6599 Display *dpy = FRAME_W32_DISPLAY (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6600 XImage *ximg, *mask_img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6601 int x, y, rc, look_at_corners_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6602 unsigned long bg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6603
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6604 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6605
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6606 /* Create an image and pixmap serving as mask. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6607 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6608 &mask_img, &img->mask);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6609 if (!rc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6610 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6611 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6612 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6613 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6614
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6615 /* Get the X image of IMG->pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6616 ximg = XGetImage (dpy, img->pixmap, 0, 0, img->width, img->height,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6617 ~0, ZPixmap);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6618
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6619 /* Determine the background color of ximg. If HOW is `(R G B)'
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6620 take that as color. Otherwise, try to determine the color
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6621 heuristically. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6622 look_at_corners_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6623
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6624 if (CONSP (how))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6625 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6626 int rgb[3], i = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6627
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6628 while (i < 3
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6629 && CONSP (how)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6630 && NATNUMP (XCAR (how)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6631 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6632 rgb[i] = XFASTINT (XCAR (how)) & 0xffff;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6633 how = XCDR (how);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6634 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6635
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6636 if (i == 3 && NILP (how))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6637 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6638 char color_name[30];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6639 XColor exact, color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6640 Colormap cmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6641
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6642 sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6643
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6644 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6645 if (XLookupColor (dpy, cmap, color_name, &exact, &color))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6646 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6647 bg = color.pixel;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6648 look_at_corners_p = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6649 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6650 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6651 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6652
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6653 if (look_at_corners_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6654 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6655 unsigned long corners[4];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6656 int i, best_count;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6657
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6658 /* Get the colors at the corners of ximg. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6659 corners[0] = XGetPixel (ximg, 0, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6660 corners[1] = XGetPixel (ximg, img->width - 1, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6661 corners[2] = XGetPixel (ximg, img->width - 1, img->height - 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6662 corners[3] = XGetPixel (ximg, 0, img->height - 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6663
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6664 /* Choose the most frequently found color as background. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6665 for (i = best_count = 0; i < 4; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6666 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6667 int j, n;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6668
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6669 for (j = n = 0; j < 4; ++j)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6670 if (corners[i] == corners[j])
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6671 ++n;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6672
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6673 if (n > best_count)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6674 bg = corners[i], best_count = n;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6675 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6676 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6677
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6678 /* Set all bits in mask_img to 1 whose color in ximg is different
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6679 from the background color bg. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6680 for (y = 0; y < img->height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6681 for (x = 0; x < img->width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6682 XPutPixel (mask_img, x, y, XGetPixel (ximg, x, y) != bg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6683
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6684 /* Put mask_img into img->mask. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6685 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6686 x_destroy_x_image (mask_img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6687 XDestroyImage (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6688
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6689 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6690 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6691
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6692 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6693 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6694
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6695
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6696
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6697 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6698 PBM (mono, gray, color)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6699 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6700 #ifdef HAVE_PBM
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6701
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6702 static int pbm_image_p P_ ((Lisp_Object object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6703 static int pbm_load P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6704 static int pbm_scan_number P_ ((unsigned char **, unsigned char *));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6705
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6706 /* The symbol `pbm' identifying images of this type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6707
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6708 Lisp_Object Qpbm;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6709
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6710 /* Indices of image specification fields in gs_format, below. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6711
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6712 enum pbm_keyword_index
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6713 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6714 PBM_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6715 PBM_FILE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6716 PBM_DATA,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6717 PBM_ASCENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6718 PBM_MARGIN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6719 PBM_RELIEF,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6720 PBM_ALGORITHM,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6721 PBM_HEURISTIC_MASK,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6722 PBM_LAST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6723 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6724
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6725 /* Vector of image_keyword structures describing the format
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6726 of valid user-defined image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6727
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6728 static struct image_keyword pbm_format[PBM_LAST] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6729 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6730 {":type", IMAGE_SYMBOL_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6731 {":file", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6732 {":data", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6733 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
6734 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6735 {":relief", IMAGE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
6736 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6737 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6738 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6739
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6740 /* Structure describing the image type `pbm'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6741
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6742 static struct image_type pbm_type =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6743 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6744 &Qpbm,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6745 pbm_image_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6746 pbm_load,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6747 x_clear_image,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6748 NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6749 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6750
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6751
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6752 /* Return non-zero if OBJECT is a valid PBM image specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6753
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6754 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6755 pbm_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6756 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6757 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6758 struct image_keyword fmt[PBM_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6759
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6760 bcopy (pbm_format, fmt, sizeof fmt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6761
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6762 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6763 || (fmt[PBM_ASCENT].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6764 && XFASTINT (fmt[PBM_ASCENT].value) > 100))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6765 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6766
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6767 /* Must specify either :data or :file. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6768 return fmt[PBM_DATA].count + fmt[PBM_FILE].count == 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6769 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6770
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6771
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6772 /* Scan a decimal number from *S and return it. Advance *S while
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6773 reading the number. END is the end of the string. Value is -1 at
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6774 end of input. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6775
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6776 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6777 pbm_scan_number (s, end)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6778 unsigned char **s, *end;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6779 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6780 int c, val = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6781
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6782 while (*s < end)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6783 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6784 /* Skip white-space. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6785 while (*s < end && (c = *(*s)++, isspace (c)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6786 ;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6787
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6788 if (c == '#')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6789 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6790 /* Skip comment to end of line. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6791 while (*s < end && (c = *(*s)++, c != '\n'))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6792 ;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6793 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6794 else if (isdigit (c))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6795 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6796 /* Read decimal number. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6797 val = c - '0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6798 while (*s < end && (c = *(*s)++, isdigit (c)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6799 val = 10 * val + c - '0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6800 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6801 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6802 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6803 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6804 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6805
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6806 return val;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6807 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6808
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6809
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6810 /* Read FILE into memory. Value is a pointer to a buffer allocated
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6811 with xmalloc holding FILE's contents. Value is null if an error
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6812 occured. *SIZE is set to the size of the file. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6813
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6814 static char *
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6815 pbm_read_file (file, size)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6816 Lisp_Object file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6817 int *size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6818 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6819 FILE *fp = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6820 char *buf = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6821 struct stat st;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6822
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6823 if (stat (XSTRING (file)->data, &st) == 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6824 && (fp = fopen (XSTRING (file)->data, "r")) != NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6825 && (buf = (char *) xmalloc (st.st_size),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6826 fread (buf, 1, st.st_size, fp) == st.st_size))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6827 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6828 *size = st.st_size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6829 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6830 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6831 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6832 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6833 if (fp)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6834 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6835 if (buf)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6836 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6837 xfree (buf);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6838 buf = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6839 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6840 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6841
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6842 return buf;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6843 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6844
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6845
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6846 /* Load PBM image IMG for use on frame F. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6847
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6848 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6849 pbm_load (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6850 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6851 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6852 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6853 int raw_p, x, y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6854 int width, height, max_color_idx = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6855 XImage *ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6856 Lisp_Object file, specified_file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6857 enum {PBM_MONO, PBM_GRAY, PBM_COLOR} type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6858 struct gcpro gcpro1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6859 unsigned char *contents = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6860 unsigned char *end, *p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6861 int size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6862
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6863 specified_file = image_spec_value (img->spec, QCfile, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6864 file = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6865 GCPRO1 (file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6866
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6867 if (STRINGP (specified_file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6868 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6869 file = x_find_image_file (specified_file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6870 if (!STRINGP (file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6871 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6872 image_error ("Cannot find image file `%s'", specified_file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6873 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6874 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6875 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6876
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6877 contents = pbm_read_file (file, &size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6878 if (contents == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6879 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6880 image_error ("Error reading `%s'", file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6881 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6882 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6883 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6884
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6885 p = contents;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6886 end = contents + size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6887 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6888 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6889 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6890 Lisp_Object data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6891 data = image_spec_value (img->spec, QCdata, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6892 p = XSTRING (data)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6893 end = p + STRING_BYTES (XSTRING (data));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6894 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6895
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6896 /* Check magic number. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6897 if (end - p < 2 || *p++ != 'P')
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6898 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6899 image_error ("Not a PBM image: `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6900 error:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6901 xfree (contents);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6902 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6903 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6904 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6905
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6906 switch (*p++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6907 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6908 case '1':
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6909 raw_p = 0, type = PBM_MONO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6910 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6911
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6912 case '2':
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6913 raw_p = 0, type = PBM_GRAY;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6914 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6915
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6916 case '3':
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6917 raw_p = 0, type = PBM_COLOR;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6918 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6919
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6920 case '4':
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6921 raw_p = 1, type = PBM_MONO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6922 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6923
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6924 case '5':
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6925 raw_p = 1, type = PBM_GRAY;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6926 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6927
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6928 case '6':
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6929 raw_p = 1, type = PBM_COLOR;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6930 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6931
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6932 default:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6933 image_error ("Not a PBM image: `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6934 goto error;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6935 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6936
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6937 /* Read width, height, maximum color-component. Characters
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6938 starting with `#' up to the end of a line are ignored. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6939 width = pbm_scan_number (&p, end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6940 height = pbm_scan_number (&p, end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6941
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6942 if (type != PBM_MONO)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6943 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6944 max_color_idx = pbm_scan_number (&p, end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6945 if (raw_p && max_color_idx > 255)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6946 max_color_idx = 255;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6947 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6948
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6949 if (width < 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6950 || height < 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6951 || (type != PBM_MONO && max_color_idx < 0))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6952 goto error;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6953
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6954 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6955 if (!x_create_x_image_and_pixmap (f, width, height, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6956 &ximg, &img->pixmap))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6957 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6958 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6959 goto error;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6960 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6961
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6962 /* Initialize the color hash table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6963 init_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6964
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6965 if (type == PBM_MONO)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6966 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6967 int c = 0, g;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6968
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6969 for (y = 0; y < height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6970 for (x = 0; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6971 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6972 if (raw_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6973 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6974 if ((x & 7) == 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6975 c = *p++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6976 g = c & 0x80;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6977 c <<= 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6978 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6979 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6980 g = pbm_scan_number (&p, end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6981
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6982 XPutPixel (ximg, x, y, (g
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6983 ? FRAME_FOREGROUND_PIXEL (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6984 : FRAME_BACKGROUND_PIXEL (f)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6985 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6986 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6987 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6988 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6989 for (y = 0; y < height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6990 for (x = 0; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6991 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6992 int r, g, b;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6993
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6994 if (type == PBM_GRAY)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6995 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6996 else if (raw_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6997 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6998 r = *p++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
6999 g = *p++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7000 b = *p++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7001 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7002 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7003 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7004 r = pbm_scan_number (&p, end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7005 g = pbm_scan_number (&p, end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7006 b = pbm_scan_number (&p, end);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7007 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7008
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7009 if (r < 0 || g < 0 || b < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7010 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7011 xfree (ximg->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7012 ximg->data = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7013 XDestroyImage (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7014 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7015 image_error ("Invalid pixel value in image `%s'",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7016 img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7017 goto error;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7018 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7019
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7020 /* RGB values are now in the range 0..max_color_idx.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7021 Scale this to the range 0..0xffff supported by X. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7022 r = (double) r * 65535 / max_color_idx;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7023 g = (double) g * 65535 / max_color_idx;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7024 b = (double) b * 65535 / max_color_idx;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7025 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7026 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7027 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7028
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7029 /* Store in IMG->colors the colors allocated for the image, and
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7030 free the color table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7031 img->colors = colors_in_color_table (&img->ncolors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7032 free_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7033
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7034 /* Put the image into a pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7035 x_put_x_image (f, ximg, img->pixmap, width, height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7036 x_destroy_x_image (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7037 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7038
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7039 img->width = width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7040 img->height = height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7041
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7042 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7043 xfree (contents);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7044 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7045 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7046 #endif /* HAVE_PBM */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7047
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7048
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7049 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7050 PNG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7051 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7052
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7053 #if HAVE_PNG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7054
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7055 #include <png.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7056
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7057 /* Function prototypes. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7058
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7059 static int png_image_p P_ ((Lisp_Object object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7060 static int png_load P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7061
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7062 /* The symbol `png' identifying images of this type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7063
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7064 Lisp_Object Qpng;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7065
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7066 /* Indices of image specification fields in png_format, below. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7067
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7068 enum png_keyword_index
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7069 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7070 PNG_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7071 PNG_DATA,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7072 PNG_FILE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7073 PNG_ASCENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7074 PNG_MARGIN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7075 PNG_RELIEF,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7076 PNG_ALGORITHM,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7077 PNG_HEURISTIC_MASK,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7078 PNG_LAST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7079 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7080
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7081 /* Vector of image_keyword structures describing the format
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7082 of valid user-defined image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7083
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7084 static struct image_keyword png_format[PNG_LAST] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7085 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7086 {":type", IMAGE_SYMBOL_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7087 {":data", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7088 {":file", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7089 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
7090 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7091 {":relief", IMAGE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
7092 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7093 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7094 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7095
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7096 /* Structure describing the image type `png'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7097
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7098 static struct image_type png_type =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7099 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7100 &Qpng,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7101 png_image_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7102 png_load,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7103 x_clear_image,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7104 NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7105 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7106
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7107
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7108 /* Return non-zero if OBJECT is a valid PNG image specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7109
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7110 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7111 png_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7112 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7113 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7114 struct image_keyword fmt[PNG_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7115 bcopy (png_format, fmt, sizeof fmt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7116
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7117 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7118 || (fmt[PNG_ASCENT].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7119 && XFASTINT (fmt[PNG_ASCENT].value) > 100))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7120 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7121
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7122 /* Must specify either the :data or :file keyword. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7123 return fmt[PNG_FILE].count + fmt[PNG_DATA].count == 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7124 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7125
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7126
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7127 /* Error and warning handlers installed when the PNG library
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7128 is initialized. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7129
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7130 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7131 my_png_error (png_ptr, msg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7132 png_struct *png_ptr;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7133 char *msg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7134 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7135 xassert (png_ptr != NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7136 image_error ("PNG error: %s", build_string (msg), Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7137 longjmp (png_ptr->jmpbuf, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7138 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7139
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7140
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7141 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7142 my_png_warning (png_ptr, msg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7143 png_struct *png_ptr;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7144 char *msg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7145 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7146 xassert (png_ptr != NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7147 image_error ("PNG warning: %s", build_string (msg), Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7148 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7149
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7150 /* Memory source for PNG decoding. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7151
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7152 struct png_memory_storage
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7153 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7154 unsigned char *bytes; /* The data */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7155 size_t len; /* How big is it? */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7156 int index; /* Where are we? */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7157 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7158
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7159
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7160 /* Function set as reader function when reading PNG image from memory.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7161 PNG_PTR is a pointer to the PNG control structure. Copy LENGTH
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7162 bytes from the input to DATA. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7163
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7164 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7165 png_read_from_memory (png_ptr, data, length)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7166 png_structp png_ptr;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7167 png_bytep data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7168 png_size_t length;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7169 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7170 struct png_memory_storage *tbr
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7171 = (struct png_memory_storage *) png_get_io_ptr (png_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7172
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7173 if (length > tbr->len - tbr->index)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7174 png_error (png_ptr, "Read error");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7175
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7176 bcopy (tbr->bytes + tbr->index, data, length);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7177 tbr->index = tbr->index + length;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7178 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7179
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7180 /* Load PNG image IMG for use on frame F. Value is non-zero if
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7181 successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7182
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7183 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7184 png_load (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7185 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7186 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7187 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7188 Lisp_Object file, specified_file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7189 Lisp_Object specified_data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7190 int x, y, i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7191 XImage *ximg, *mask_img = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7192 struct gcpro gcpro1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7193 png_struct *png_ptr = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7194 png_info *info_ptr = NULL, *end_info = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7195 FILE *fp = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7196 png_byte sig[8];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7197 png_byte *pixels = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7198 png_byte **rows = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7199 png_uint_32 width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7200 int bit_depth, color_type, interlace_type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7201 png_byte channels;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7202 png_uint_32 row_bytes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7203 int transparent_p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7204 char *gamma_str;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7205 double screen_gamma, image_gamma;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7206 int intent;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7207 struct png_memory_storage tbr; /* Data to be read */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7208
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7209 /* Find out what file to load. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7210 specified_file = image_spec_value (img->spec, QCfile, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7211 specified_data = image_spec_value (img->spec, QCdata, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7212 file = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7213 GCPRO1 (file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7214
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7215 if (NILP (specified_data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7216 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7217 file = x_find_image_file (specified_file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7218 if (!STRINGP (file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7219 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7220 image_error ("Cannot find image file `%s'", specified_file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7221 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7222 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7223 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7224
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7225 /* Open the image file. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7226 fp = fopen (XSTRING (file)->data, "rb");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7227 if (!fp)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7228 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7229 image_error ("Cannot open image file `%s'", file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7230 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7231 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7232 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7233 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7234
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7235 /* Check PNG signature. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7236 if (fread (sig, 1, sizeof sig, fp) != sizeof sig
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7237 || !png_check_sig (sig, sizeof sig))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7238 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7239 image_error ("Not a PNG file:` %s'", file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7240 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7241 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7242 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7243 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7244 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7245 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7246 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7247 /* Read from memory. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7248 tbr.bytes = XSTRING (specified_data)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7249 tbr.len = STRING_BYTES (XSTRING (specified_data));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7250 tbr.index = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7251
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7252 /* Check PNG signature. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7253 if (tbr.len < sizeof sig
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7254 || !png_check_sig (tbr.bytes, sizeof sig))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7255 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7256 image_error ("Not a PNG image: `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7257 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7258 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7259 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7260
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7261 /* Need to skip past the signature. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7262 tbr.bytes += sizeof (sig);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7263 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7264
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7265 /* Initialize read and info structs for PNG lib. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7266 png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7267 my_png_error, my_png_warning);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7268 if (!png_ptr)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7269 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7270 if (fp) fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7271 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7272 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7273 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7274
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7275 info_ptr = png_create_info_struct (png_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7276 if (!info_ptr)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7277 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7278 png_destroy_read_struct (&png_ptr, NULL, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7279 if (fp) fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7280 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7281 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7282 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7283
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7284 end_info = png_create_info_struct (png_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7285 if (!end_info)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7286 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7287 png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7288 if (fp) fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7289 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7290 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7291 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7292
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7293 /* Set error jump-back. We come back here when the PNG library
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7294 detects an error. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7295 if (setjmp (png_ptr->jmpbuf))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7296 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7297 error:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7298 if (png_ptr)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7299 png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7300 xfree (pixels);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7301 xfree (rows);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7302 if (fp) fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7303 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7304 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7305 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7306
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7307 /* Read image info. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7308 if (!NILP (specified_data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7309 png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7310 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7311 png_init_io (png_ptr, fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7312
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7313 png_set_sig_bytes (png_ptr, sizeof sig);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7314 png_read_info (png_ptr, info_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7315 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7316 &interlace_type, NULL, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7317
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7318 /* If image contains simply transparency data, we prefer to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7319 construct a clipping mask. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7320 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7321 transparent_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7322 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7323 transparent_p = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7324
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7325 /* This function is easier to write if we only have to handle
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7326 one data format: RGB or RGBA with 8 bits per channel. Let's
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7327 transform other formats into that format. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7328
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7329 /* Strip more than 8 bits per channel. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7330 if (bit_depth == 16)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7331 png_set_strip_16 (png_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7332
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7333 /* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha channel
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7334 if available. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7335 png_set_expand (png_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7336
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7337 /* Convert grayscale images to RGB. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7338 if (color_type == PNG_COLOR_TYPE_GRAY
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7339 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7340 png_set_gray_to_rgb (png_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7341
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7342 /* The value 2.2 is a guess for PC monitors from PNG example.c. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7343 gamma_str = getenv ("SCREEN_GAMMA");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7344 screen_gamma = gamma_str ? atof (gamma_str) : 2.2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7345
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7346 /* Tell the PNG lib to handle gamma correction for us. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7347
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7348 #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7349 if (png_get_sRGB (png_ptr, info_ptr, &intent))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7350 /* There is a special chunk in the image specifying the gamma. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7351 png_set_sRGB (png_ptr, info_ptr, intent);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7352 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7353 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7354 if (png_get_gAMA (png_ptr, info_ptr, &image_gamma))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7355 /* Image contains gamma information. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7356 png_set_gamma (png_ptr, screen_gamma, image_gamma);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7357 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7358 /* Use a default of 0.5 for the image gamma. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7359 png_set_gamma (png_ptr, screen_gamma, 0.5);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7360
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7361 /* Handle alpha channel by combining the image with a background
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7362 color. Do this only if a real alpha channel is supplied. For
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7363 simple transparency, we prefer a clipping mask. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7364 if (!transparent_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7365 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7366 png_color_16 *image_background;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7367
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7368 if (png_get_bKGD (png_ptr, info_ptr, &image_background))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7369 /* Image contains a background color with which to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7370 combine the image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7371 png_set_background (png_ptr, image_background,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7372 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7373 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7374 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7375 /* Image does not contain a background color with which
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7376 to combine the image data via an alpha channel. Use
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7377 the frame's background instead. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7378 XColor color;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7379 Colormap cmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7380 png_color_16 frame_background;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7381
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7382 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7383 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7384 color.pixel = FRAME_BACKGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7385 XQueryColor (FRAME_W32_DISPLAY (f), cmap, &color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7386 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7387
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7388 bzero (&frame_background, sizeof frame_background);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7389 frame_background.red = color.red;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7390 frame_background.green = color.green;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7391 frame_background.blue = color.blue;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7392
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7393 png_set_background (png_ptr, &frame_background,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7394 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7395 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7396 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7397
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7398 /* Update info structure. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7399 png_read_update_info (png_ptr, info_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7400
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7401 /* Get number of channels. Valid values are 1 for grayscale images
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7402 and images with a palette, 2 for grayscale images with transparency
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7403 information (alpha channel), 3 for RGB images, and 4 for RGB
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7404 images with alpha channel, i.e. RGBA. If conversions above were
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7405 sufficient we should only have 3 or 4 channels here. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7406 channels = png_get_channels (png_ptr, info_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7407 xassert (channels == 3 || channels == 4);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7408
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7409 /* Number of bytes needed for one row of the image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7410 row_bytes = png_get_rowbytes (png_ptr, info_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7411
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7412 /* Allocate memory for the image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7413 pixels = (png_byte *) xmalloc (row_bytes * height * sizeof *pixels);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7414 rows = (png_byte **) xmalloc (height * sizeof *rows);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7415 for (i = 0; i < height; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7416 rows[i] = pixels + i * row_bytes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7417
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7418 /* Read the entire image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7419 png_read_image (png_ptr, rows);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7420 png_read_end (png_ptr, info_ptr);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7421 if (fp)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7422 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7423 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7424 fp = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7425 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7426
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7427 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7428
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7429 /* Create the X image and pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7430 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7431 &img->pixmap))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7432 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7433 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7434 goto error;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7435 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7436
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7437 /* Create an image and pixmap serving as mask if the PNG image
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7438 contains an alpha channel. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7439 if (channels == 4
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7440 && !transparent_p
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7441 && !x_create_x_image_and_pixmap (f, width, height, 1,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7442 &mask_img, &img->mask))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7443 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7444 x_destroy_x_image (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7445 XFreePixmap (FRAME_W32_DISPLAY (f), img->pixmap);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7446 img->pixmap = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7447 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7448 goto error;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7449 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7450
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7451 /* Fill the X image and mask from PNG data. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7452 init_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7453
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7454 for (y = 0; y < height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7455 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7456 png_byte *p = rows[y];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7457
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7458 for (x = 0; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7459 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7460 unsigned r, g, b;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7461
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7462 r = *p++ << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7463 g = *p++ << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7464 b = *p++ << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7465 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7466
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7467 /* An alpha channel, aka mask channel, associates variable
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7468 transparency with an image. Where other image formats
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7469 support binary transparency---fully transparent or fully
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7470 opaque---PNG allows up to 254 levels of partial transparency.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7471 The PNG library implements partial transparency by combining
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7472 the image with a specified background color.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7473
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7474 I'm not sure how to handle this here nicely: because the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7475 background on which the image is displayed may change, for
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7476 real alpha channel support, it would be necessary to create
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7477 a new image for each possible background.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7478
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7479 What I'm doing now is that a mask is created if we have
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7480 boolean transparency information. Otherwise I'm using
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7481 the frame's background color to combine the image with. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7482
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7483 if (channels == 4)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7484 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7485 if (mask_img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7486 XPutPixel (mask_img, x, y, *p > 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7487 ++p;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7488 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7489 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7490 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7491
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7492 /* Remember colors allocated for this image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7493 img->colors = colors_in_color_table (&img->ncolors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7494 free_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7495
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7496 /* Clean up. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7497 png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7498 xfree (rows);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7499 xfree (pixels);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7500
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7501 img->width = width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7502 img->height = height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7503
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7504 /* Put the image into the pixmap, then free the X image and its buffer. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7505 x_put_x_image (f, ximg, img->pixmap, width, height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7506 x_destroy_x_image (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7507
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7508 /* Same for the mask. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7509 if (mask_img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7510 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7511 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7512 x_destroy_x_image (mask_img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7513 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7514
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7515 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7516 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7517 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7518 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7519
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7520 #endif /* HAVE_PNG != 0 */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7521
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7522
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7523
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7524 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7525 JPEG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7526 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7527
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7528 #if HAVE_JPEG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7529
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7530 /* Work around a warning about HAVE_STDLIB_H being redefined in
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7531 jconfig.h. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7532 #ifdef HAVE_STDLIB_H
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7533 #define HAVE_STDLIB_H_1
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7534 #undef HAVE_STDLIB_H
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7535 #endif /* HAVE_STLIB_H */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7536
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7537 #include <jpeglib.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7538 #include <jerror.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7539 #include <setjmp.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7540
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7541 #ifdef HAVE_STLIB_H_1
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7542 #define HAVE_STDLIB_H 1
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7543 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7544
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7545 static int jpeg_image_p P_ ((Lisp_Object object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7546 static int jpeg_load P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7547
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7548 /* The symbol `jpeg' identifying images of this type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7549
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7550 Lisp_Object Qjpeg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7551
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7552 /* Indices of image specification fields in gs_format, below. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7553
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7554 enum jpeg_keyword_index
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7555 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7556 JPEG_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7557 JPEG_DATA,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7558 JPEG_FILE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7559 JPEG_ASCENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7560 JPEG_MARGIN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7561 JPEG_RELIEF,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7562 JPEG_ALGORITHM,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7563 JPEG_HEURISTIC_MASK,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7564 JPEG_LAST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7565 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7566
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7567 /* Vector of image_keyword structures describing the format
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7568 of valid user-defined image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7569
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7570 static struct image_keyword jpeg_format[JPEG_LAST] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7571 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7572 {":type", IMAGE_SYMBOL_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7573 {":data", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7574 {":file", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7575 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
7576 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7577 {":relief", IMAGE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
7578 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7579 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7580 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7581
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7582 /* Structure describing the image type `jpeg'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7583
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7584 static struct image_type jpeg_type =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7585 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7586 &Qjpeg,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7587 jpeg_image_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7588 jpeg_load,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7589 x_clear_image,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7590 NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7591 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7592
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7593
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7594 /* Return non-zero if OBJECT is a valid JPEG image specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7595
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7596 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7597 jpeg_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7598 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7599 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7600 struct image_keyword fmt[JPEG_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7601
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7602 bcopy (jpeg_format, fmt, sizeof fmt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7603
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7604 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7605 || (fmt[JPEG_ASCENT].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7606 && XFASTINT (fmt[JPEG_ASCENT].value) > 100))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7607 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7608
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7609 /* Must specify either the :data or :file keyword. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7610 return fmt[JPEG_FILE].count + fmt[JPEG_DATA].count == 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7611 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7612
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7613
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7614 struct my_jpeg_error_mgr
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7615 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7616 struct jpeg_error_mgr pub;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7617 jmp_buf setjmp_buffer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7618 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7619
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7620 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7621 my_error_exit (cinfo)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7622 j_common_ptr cinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7623 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7624 struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7625 longjmp (mgr->setjmp_buffer, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7626 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7627
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7628 /* Init source method for JPEG data source manager. Called by
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7629 jpeg_read_header() before any data is actually read. See
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7630 libjpeg.doc from the JPEG lib distribution. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7631
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7632 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7633 our_init_source (cinfo)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7634 j_decompress_ptr cinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7635 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7636 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7637
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7638
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7639 /* Fill input buffer method for JPEG data source manager. Called
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7640 whenever more data is needed. We read the whole image in one step,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7641 so this only adds a fake end of input marker at the end. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7642
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7643 static boolean
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7644 our_fill_input_buffer (cinfo)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7645 j_decompress_ptr cinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7646 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7647 /* Insert a fake EOI marker. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7648 struct jpeg_source_mgr *src = cinfo->src;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7649 static JOCTET buffer[2];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7650
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7651 buffer[0] = (JOCTET) 0xFF;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7652 buffer[1] = (JOCTET) JPEG_EOI;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7653
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7654 src->next_input_byte = buffer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7655 src->bytes_in_buffer = 2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7656 return TRUE;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7657 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7658
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7659
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7660 /* Method to skip over NUM_BYTES bytes in the image data. CINFO->src
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7661 is the JPEG data source manager. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7662
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7663 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7664 our_skip_input_data (cinfo, num_bytes)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7665 j_decompress_ptr cinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7666 long num_bytes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7667 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7668 struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7669
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7670 if (src)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7671 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7672 if (num_bytes > src->bytes_in_buffer)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7673 ERREXIT (cinfo, JERR_INPUT_EOF);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7674
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7675 src->bytes_in_buffer -= num_bytes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7676 src->next_input_byte += num_bytes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7677 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7678 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7679
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7680
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7681 /* Method to terminate data source. Called by
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7682 jpeg_finish_decompress() after all data has been processed. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7683
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7684 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7685 our_term_source (cinfo)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7686 j_decompress_ptr cinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7687 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7688 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7689
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7690
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7691 /* Set up the JPEG lib for reading an image from DATA which contains
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7692 LEN bytes. CINFO is the decompression info structure created for
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7693 reading the image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7694
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7695 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7696 jpeg_memory_src (cinfo, data, len)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7697 j_decompress_ptr cinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7698 JOCTET *data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7699 unsigned int len;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7700 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7701 struct jpeg_source_mgr *src;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7702
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7703 if (cinfo->src == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7704 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7705 /* First time for this JPEG object? */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7706 cinfo->src = (struct jpeg_source_mgr *)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7707 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7708 sizeof (struct jpeg_source_mgr));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7709 src = (struct jpeg_source_mgr *) cinfo->src;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7710 src->next_input_byte = data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7711 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7712
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7713 src = (struct jpeg_source_mgr *) cinfo->src;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7714 src->init_source = our_init_source;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7715 src->fill_input_buffer = our_fill_input_buffer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7716 src->skip_input_data = our_skip_input_data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7717 src->resync_to_restart = jpeg_resync_to_restart; /* Use default method. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7718 src->term_source = our_term_source;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7719 src->bytes_in_buffer = len;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7720 src->next_input_byte = data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7721 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7722
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7723
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7724 /* Load image IMG for use on frame F. Patterned after example.c
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7725 from the JPEG lib. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7726
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7727 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7728 jpeg_load (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7729 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7730 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7731 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7732 struct jpeg_decompress_struct cinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7733 struct my_jpeg_error_mgr mgr;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7734 Lisp_Object file, specified_file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7735 Lisp_Object specified_data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7736 FILE *fp = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7737 JSAMPARRAY buffer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7738 int row_stride, x, y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7739 XImage *ximg = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7740 int rc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7741 unsigned long *colors;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7742 int width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7743 struct gcpro gcpro1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7744
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7745 /* Open the JPEG file. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7746 specified_file = image_spec_value (img->spec, QCfile, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7747 specified_data = image_spec_value (img->spec, QCdata, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7748 file = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7749 GCPRO1 (file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7750
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7751 if (NILP (specified_data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7752 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7753 file = x_find_image_file (specified_file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7754 if (!STRINGP (file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7755 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7756 image_error ("Cannot find image file `%s'", specified_file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7757 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7758 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7759 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7760
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7761 fp = fopen (XSTRING (file)->data, "r");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7762 if (fp == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7763 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7764 image_error ("Cannot open `%s'", file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7765 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7766 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7767 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7768 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7769
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7770 /* Customize libjpeg's error handling to call my_error_exit when an
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7771 error is detected. This function will perform a longjmp. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7772 mgr.pub.error_exit = my_error_exit;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7773 cinfo.err = jpeg_std_error (&mgr.pub);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7774
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7775 if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7776 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7777 if (rc == 1)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7778 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7779 /* Called from my_error_exit. Display a JPEG error. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7780 char buffer[JMSG_LENGTH_MAX];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7781 cinfo.err->format_message ((j_common_ptr) &cinfo, buffer);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7782 image_error ("Error reading JPEG image `%s': %s", img->spec,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7783 build_string (buffer));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7784 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7785
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7786 /* Close the input file and destroy the JPEG object. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7787 if (fp)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7788 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7789 jpeg_destroy_decompress (&cinfo);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7790
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7791 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7792
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7793 /* If we already have an XImage, free that. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7794 x_destroy_x_image (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7795
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7796 /* Free pixmap and colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7797 x_clear_image (f, img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7798
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7799 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7800 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7801 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7802 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7803
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7804 /* Create the JPEG decompression object. Let it read from fp.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7805 Read the JPEG image header. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7806 jpeg_create_decompress (&cinfo);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7807
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7808 if (NILP (specified_data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7809 jpeg_stdio_src (&cinfo, fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7810 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7811 jpeg_memory_src (&cinfo, XSTRING (specified_data)->data,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7812 STRING_BYTES (XSTRING (specified_data)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7813
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7814 jpeg_read_header (&cinfo, TRUE);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7815
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7816 /* Customize decompression so that color quantization will be used.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7817 Start decompression. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7818 cinfo.quantize_colors = TRUE;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7819 jpeg_start_decompress (&cinfo);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7820 width = img->width = cinfo.output_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7821 height = img->height = cinfo.output_height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7822
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7823 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7824
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7825 /* Create X image and pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7826 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7827 &img->pixmap))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7828 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7829 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7830 longjmp (mgr.setjmp_buffer, 2);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7831 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7832
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7833 /* Allocate colors. When color quantization is used,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7834 cinfo.actual_number_of_colors has been set with the number of
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7835 colors generated, and cinfo.colormap is a two-dimensional array
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7836 of color indices in the range 0..cinfo.actual_number_of_colors.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7837 No more than 255 colors will be generated. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7838 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7839 int i, ir, ig, ib;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7840
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7841 if (cinfo.out_color_components > 2)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7842 ir = 0, ig = 1, ib = 2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7843 else if (cinfo.out_color_components > 1)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7844 ir = 0, ig = 1, ib = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7845 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7846 ir = 0, ig = 0, ib = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7847
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7848 /* Use the color table mechanism because it handles colors that
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7849 cannot be allocated nicely. Such colors will be replaced with
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7850 a default color, and we don't have to care about which colors
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7851 can be freed safely, and which can't. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7852 init_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7853 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7854 * sizeof *colors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7855
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7856 for (i = 0; i < cinfo.actual_number_of_colors; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7857 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7858 /* Multiply RGB values with 255 because X expects RGB values
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7859 in the range 0..0xffff. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7860 int r = cinfo.colormap[ir][i] << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7861 int g = cinfo.colormap[ig][i] << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7862 int b = cinfo.colormap[ib][i] << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7863 colors[i] = lookup_rgb_color (f, r, g, b);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7864 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7865
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7866 /* Remember those colors actually allocated. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7867 img->colors = colors_in_color_table (&img->ncolors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7868 free_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7869 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7870
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7871 /* Read pixels. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7872 row_stride = width * cinfo.output_components;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7873 buffer = cinfo.mem->alloc_sarray ((j_common_ptr) &cinfo, JPOOL_IMAGE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7874 row_stride, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7875 for (y = 0; y < height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7876 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7877 jpeg_read_scanlines (&cinfo, buffer, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7878 for (x = 0; x < cinfo.output_width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7879 XPutPixel (ximg, x, y, colors[buffer[0][x]]);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7880 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7881
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7882 /* Clean up. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7883 jpeg_finish_decompress (&cinfo);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7884 jpeg_destroy_decompress (&cinfo);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7885 if (fp)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7886 fclose (fp);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7887
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7888 /* Put the image into the pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7889 x_put_x_image (f, ximg, img->pixmap, width, height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7890 x_destroy_x_image (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7891 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7892 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7893 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7894 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7895
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7896 #endif /* HAVE_JPEG */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7897
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7898
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7899
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7900 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7901 TIFF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7902 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7903
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7904 #if HAVE_TIFF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7905
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7906 #include <tiffio.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7907
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7908 static int tiff_image_p P_ ((Lisp_Object object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7909 static int tiff_load P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7910
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7911 /* The symbol `tiff' identifying images of this type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7912
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7913 Lisp_Object Qtiff;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7914
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7915 /* Indices of image specification fields in tiff_format, below. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7916
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7917 enum tiff_keyword_index
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7918 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7919 TIFF_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7920 TIFF_DATA,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7921 TIFF_FILE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7922 TIFF_ASCENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7923 TIFF_MARGIN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7924 TIFF_RELIEF,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7925 TIFF_ALGORITHM,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7926 TIFF_HEURISTIC_MASK,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7927 TIFF_LAST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7928 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7929
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7930 /* Vector of image_keyword structures describing the format
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7931 of valid user-defined image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7932
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7933 static struct image_keyword tiff_format[TIFF_LAST] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7934 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7935 {":type", IMAGE_SYMBOL_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7936 {":data", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7937 {":file", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7938 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
7939 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7940 {":relief", IMAGE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
7941 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7942 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7943 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7944
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7945 /* Structure describing the image type `tiff'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7946
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7947 static struct image_type tiff_type =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7948 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7949 &Qtiff,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7950 tiff_image_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7951 tiff_load,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7952 x_clear_image,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7953 NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7954 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7955
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7956
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7957 /* Return non-zero if OBJECT is a valid TIFF image specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7958
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7959 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7960 tiff_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7961 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7962 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7963 struct image_keyword fmt[TIFF_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7964 bcopy (tiff_format, fmt, sizeof fmt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7965
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7966 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7967 || (fmt[TIFF_ASCENT].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7968 && XFASTINT (fmt[TIFF_ASCENT].value) > 100))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7969 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7970
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7971 /* Must specify either the :data or :file keyword. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7972 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7973 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7974
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7975
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7976 /* Reading from a memory buffer for TIFF images Based on the PNG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7977 memory source, but we have to provide a lot of extra functions.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7978 Blah.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7979
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7980 We really only need to implement read and seek, but I am not
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7981 convinced that the TIFF library is smart enough not to destroy
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7982 itself if we only hand it the function pointers we need to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7983 override. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7984
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7985 typedef struct
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7986 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7987 unsigned char *bytes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7988 size_t len;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7989 int index;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7990 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7991 tiff_memory_source;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7992
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7993 static size_t
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7994 tiff_read_from_memory (data, buf, size)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7995 thandle_t data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7996 tdata_t buf;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7997 tsize_t size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7998 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
7999 tiff_memory_source *src = (tiff_memory_source *) data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8000
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8001 if (size > src->len - src->index)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8002 return (size_t) -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8003 bcopy (src->bytes + src->index, buf, size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8004 src->index += size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8005 return size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8006 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8007
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8008 static size_t
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8009 tiff_write_from_memory (data, buf, size)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8010 thandle_t data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8011 tdata_t buf;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8012 tsize_t size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8013 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8014 return (size_t) -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8015 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8016
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8017 static toff_t
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8018 tiff_seek_in_memory (data, off, whence)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8019 thandle_t data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8020 toff_t off;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8021 int whence;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8022 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8023 tiff_memory_source *src = (tiff_memory_source *) data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8024 int idx;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8025
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8026 switch (whence)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8027 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8028 case SEEK_SET: /* Go from beginning of source. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8029 idx = off;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8030 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8031
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8032 case SEEK_END: /* Go from end of source. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8033 idx = src->len + off;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8034 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8035
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8036 case SEEK_CUR: /* Go from current position. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8037 idx = src->index + off;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8038 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8039
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8040 default: /* Invalid `whence'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8041 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8042 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8043
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8044 if (idx > src->len || idx < 0)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8045 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8046
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8047 src->index = idx;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8048 return src->index;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8049 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8050
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8051 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8052 tiff_close_memory (data)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8053 thandle_t data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8054 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8055 /* NOOP */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8056 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8057 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8058
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8059 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8060 tiff_mmap_memory (data, pbase, psize)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8061 thandle_t data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8062 tdata_t *pbase;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8063 toff_t *psize;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8064 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8065 /* It is already _IN_ memory. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8066 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8067 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8068
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8069 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8070 tiff_unmap_memory (data, base, size)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8071 thandle_t data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8072 tdata_t base;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8073 toff_t size;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8074 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8075 /* We don't need to do this. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8076 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8077
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8078 static toff_t
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8079 tiff_size_of_memory (data)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8080 thandle_t data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8081 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8082 return ((tiff_memory_source *) data)->len;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8083 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8084
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8085 /* Load TIFF image IMG for use on frame F. Value is non-zero if
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8086 successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8087
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8088 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8089 tiff_load (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8090 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8091 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8092 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8093 Lisp_Object file, specified_file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8094 Lisp_Object specified_data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8095 TIFF *tiff;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8096 int width, height, x, y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8097 uint32 *buf;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8098 int rc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8099 XImage *ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8100 struct gcpro gcpro1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8101 tiff_memory_source memsrc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8102
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8103 specified_file = image_spec_value (img->spec, QCfile, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8104 specified_data = image_spec_value (img->spec, QCdata, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8105 file = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8106 GCPRO1 (file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8107
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8108 if (NILP (specified_data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8109 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8110 /* Read from a file */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8111 file = x_find_image_file (specified_file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8112 if (!STRINGP (file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8113 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8114 image_error ("Cannot find image file `%s'", file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8115 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8116 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8117 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8118
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8119 /* Try to open the image file. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8120 tiff = TIFFOpen (XSTRING (file)->data, "r");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8121 if (tiff == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8122 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8123 image_error ("Cannot open `%s'", file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8124 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8125 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8126 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8127 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8128 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8129 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8130 /* Memory source! */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8131 memsrc.bytes = XSTRING (specified_data)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8132 memsrc.len = STRING_BYTES (XSTRING (specified_data));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8133 memsrc.index = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8134
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8135 tiff = TIFFClientOpen ("memory_source", "r", &memsrc,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8136 (TIFFReadWriteProc) tiff_read_from_memory,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8137 (TIFFReadWriteProc) tiff_write_from_memory,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8138 tiff_seek_in_memory,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8139 tiff_close_memory,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8140 tiff_size_of_memory,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8141 tiff_mmap_memory,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8142 tiff_unmap_memory);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8143
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8144 if (!tiff)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8145 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8146 image_error ("Cannot open memory source for `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8147 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8148 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8149 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8150 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8151
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8152 /* Get width and height of the image, and allocate a raster buffer
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8153 of width x height 32-bit values. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8154 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8155 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8156 buf = (uint32 *) xmalloc (width * height * sizeof *buf);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8157
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8158 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8159 TIFFClose (tiff);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8160 if (!rc)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8161 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8162 image_error ("Error reading TIFF image `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8163 xfree (buf);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8164 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8165 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8166 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8167
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8168 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8169
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8170 /* Create the X image and pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8171 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8172 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8173 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8174 xfree (buf);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8175 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8176 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8177 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8178
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8179 /* Initialize the color table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8180 init_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8181
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8182 /* Process the pixel raster. Origin is in the lower-left corner. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8183 for (y = 0; y < height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8184 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8185 uint32 *row = buf + y * width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8186
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8187 for (x = 0; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8188 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8189 uint32 abgr = row[x];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8190 int r = TIFFGetR (abgr) << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8191 int g = TIFFGetG (abgr) << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8192 int b = TIFFGetB (abgr) << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8193 XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8194 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8195 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8196
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8197 /* Remember the colors allocated for the image. Free the color table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8198 img->colors = colors_in_color_table (&img->ncolors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8199 free_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8200
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8201 /* Put the image into the pixmap, then free the X image and its buffer. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8202 x_put_x_image (f, ximg, img->pixmap, width, height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8203 x_destroy_x_image (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8204 xfree (buf);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8205 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8206
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8207 img->width = width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8208 img->height = height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8209
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8210 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8211 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8212 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8213
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8214 #endif /* HAVE_TIFF != 0 */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8215
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8216
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8217
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8218 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8219 GIF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8220 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8221
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8222 #if HAVE_GIF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8223
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8224 #include <gif_lib.h>
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8225
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8226 static int gif_image_p P_ ((Lisp_Object object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8227 static int gif_load P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8228
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8229 /* The symbol `gif' identifying images of this type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8230
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8231 Lisp_Object Qgif;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8232
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8233 /* Indices of image specification fields in gif_format, below. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8234
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8235 enum gif_keyword_index
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8236 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8237 GIF_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8238 GIF_DATA,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8239 GIF_FILE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8240 GIF_ASCENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8241 GIF_MARGIN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8242 GIF_RELIEF,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8243 GIF_ALGORITHM,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8244 GIF_HEURISTIC_MASK,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8245 GIF_IMAGE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8246 GIF_LAST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8247 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8248
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8249 /* Vector of image_keyword structures describing the format
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8250 of valid user-defined image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8251
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8252 static struct image_keyword gif_format[GIF_LAST] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8253 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8254 {":type", IMAGE_SYMBOL_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8255 {":data", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8256 {":file", IMAGE_STRING_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8257 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8258 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8259 {":relief", IMAGE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8260 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8261 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8262 {":image", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8263 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8264
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8265 /* Structure describing the image type `gif'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8266
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8267 static struct image_type gif_type =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8268 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8269 &Qgif,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8270 gif_image_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8271 gif_load,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8272 x_clear_image,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8273 NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8274 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8275
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8276 /* Return non-zero if OBJECT is a valid GIF image specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8277
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8278 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8279 gif_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8280 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8281 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8282 struct image_keyword fmt[GIF_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8283 bcopy (gif_format, fmt, sizeof fmt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8284
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8285 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8286 || (fmt[GIF_ASCENT].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8287 && XFASTINT (fmt[GIF_ASCENT].value) > 100))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8288 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8289
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8290 /* Must specify either the :data or :file keyword. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8291 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8292 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8293
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8294 /* Reading a GIF image from memory
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8295 Based on the PNG memory stuff to a certain extent. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8296
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8297 typedef struct
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8298 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8299 unsigned char *bytes;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8300 size_t len;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8301 int index;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8302 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8303 gif_memory_source;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8304
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8305 /* Make the current memory source available to gif_read_from_memory.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8306 It's done this way because not all versions of libungif support
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8307 a UserData field in the GifFileType structure. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8308 static gif_memory_source *current_gif_memory_src;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8309
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8310 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8311 gif_read_from_memory (file, buf, len)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8312 GifFileType *file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8313 GifByteType *buf;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8314 int len;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8315 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8316 gif_memory_source *src = current_gif_memory_src;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8317
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8318 if (len > src->len - src->index)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8319 return -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8320
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8321 bcopy (src->bytes + src->index, buf, len);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8322 src->index += len;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8323 return len;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8324 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8325
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8326
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8327 /* Load GIF image IMG for use on frame F. Value is non-zero if
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8328 successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8329
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8330 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8331 gif_load (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8332 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8333 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8334 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8335 Lisp_Object file, specified_file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8336 Lisp_Object specified_data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8337 int rc, width, height, x, y, i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8338 XImage *ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8339 ColorMapObject *gif_color_map;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8340 unsigned long pixel_colors[256];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8341 GifFileType *gif;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8342 struct gcpro gcpro1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8343 Lisp_Object image;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8344 int ino, image_left, image_top, image_width, image_height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8345 gif_memory_source memsrc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8346 unsigned char *raster;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8347
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8348 specified_file = image_spec_value (img->spec, QCfile, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8349 specified_data = image_spec_value (img->spec, QCdata, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8350 file = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8351 GCPRO1 (file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8352
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8353 if (NILP (specified_data))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8354 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8355 file = x_find_image_file (specified_file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8356 if (!STRINGP (file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8357 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8358 image_error ("Cannot find image file `%s'", specified_file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8359 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8360 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8361 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8362
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8363 /* Open the GIF file. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8364 gif = DGifOpenFileName (XSTRING (file)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8365 if (gif == NULL)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8366 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8367 image_error ("Cannot open `%s'", file, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8368 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8369 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8370 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8371 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8372 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8373 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8374 /* Read from memory! */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8375 current_gif_memory_src = &memsrc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8376 memsrc.bytes = XSTRING (specified_data)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8377 memsrc.len = STRING_BYTES (XSTRING (specified_data));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8378 memsrc.index = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8379
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8380 gif = DGifOpen(&memsrc, gif_read_from_memory);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8381 if (!gif)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8382 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8383 image_error ("Cannot open memory source `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8384 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8385 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8386 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8387 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8388
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8389 /* Read entire contents. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8390 rc = DGifSlurp (gif);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8391 if (rc == GIF_ERROR)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8392 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8393 image_error ("Error reading `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8394 DGifCloseFile (gif);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8395 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8396 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8397 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8398
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8399 image = image_spec_value (img->spec, QCindex, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8400 ino = INTEGERP (image) ? XFASTINT (image) : 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8401 if (ino >= gif->ImageCount)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8402 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8403 image_error ("Invalid image number `%s' in image `%s'",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8404 image, img->spec);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8405 DGifCloseFile (gif);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8406 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8407 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8408 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8409
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8410 width = img->width = gif->SWidth;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8411 height = img->height = gif->SHeight;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8412
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8413 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8414
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8415 /* Create the X image and pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8416 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8417 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8418 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8419 DGifCloseFile (gif);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8420 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8421 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8422 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8423
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8424 /* Allocate colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8425 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8426 if (!gif_color_map)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8427 gif_color_map = gif->SColorMap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8428 init_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8429 bzero (pixel_colors, sizeof pixel_colors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8430
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8431 for (i = 0; i < gif_color_map->ColorCount; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8432 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8433 int r = gif_color_map->Colors[i].Red << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8434 int g = gif_color_map->Colors[i].Green << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8435 int b = gif_color_map->Colors[i].Blue << 8;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8436 pixel_colors[i] = lookup_rgb_color (f, r, g, b);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8437 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8438
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8439 img->colors = colors_in_color_table (&img->ncolors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8440 free_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8441
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8442 /* Clear the part of the screen image that are not covered by
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8443 the image from the GIF file. Full animated GIF support
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8444 requires more than can be done here (see the gif89 spec,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8445 disposal methods). Let's simply assume that the part
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8446 not covered by a sub-image is in the frame's background color. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8447 image_top = gif->SavedImages[ino].ImageDesc.Top;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8448 image_left = gif->SavedImages[ino].ImageDesc.Left;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8449 image_width = gif->SavedImages[ino].ImageDesc.Width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8450 image_height = gif->SavedImages[ino].ImageDesc.Height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8451
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8452 for (y = 0; y < image_top; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8453 for (x = 0; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8454 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8455
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8456 for (y = image_top + image_height; y < height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8457 for (x = 0; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8458 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8459
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8460 for (y = image_top; y < image_top + image_height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8461 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8462 for (x = 0; x < image_left; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8463 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8464 for (x = image_left + image_width; x < width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8465 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8466 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8467
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8468 /* Read the GIF image into the X image. We use a local variable
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8469 `raster' here because RasterBits below is a char *, and invites
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8470 problems with bytes >= 0x80. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8471 raster = (unsigned char *) gif->SavedImages[ino].RasterBits;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8472
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8473 if (gif->SavedImages[ino].ImageDesc.Interlace)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8474 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8475 static int interlace_start[] = {0, 4, 2, 1};
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8476 static int interlace_increment[] = {8, 8, 4, 2};
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8477 int pass, inc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8478 int row = interlace_start[0];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8479
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8480 pass = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8481
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8482 for (y = 0; y < image_height; y++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8483 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8484 if (row >= image_height)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8485 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8486 row = interlace_start[++pass];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8487 while (row >= image_height)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8488 row = interlace_start[++pass];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8489 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8490
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8491 for (x = 0; x < image_width; x++)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8492 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8493 int i = raster[(y * image_width) + x];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8494 XPutPixel (ximg, x + image_left, row + image_top,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8495 pixel_colors[i]);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8496 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8497
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8498 row += interlace_increment[pass];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8499 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8500 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8501 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8502 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8503 for (y = 0; y < image_height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8504 for (x = 0; x < image_width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8505 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8506 int i = raster[y* image_width + x];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8507 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8508 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8509 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8510
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8511 DGifCloseFile (gif);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8512
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8513 /* Put the image into the pixmap, then free the X image and its buffer. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8514 x_put_x_image (f, ximg, img->pixmap, width, height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8515 x_destroy_x_image (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8516 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8517
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8518 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8519 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8520 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8521
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8522 #endif /* HAVE_GIF != 0 */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8523
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8524
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8525
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8526 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8527 Ghostscript
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8528 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8529
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8530 #ifdef HAVE_GHOSTSCRIPT
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8531 static int gs_image_p P_ ((Lisp_Object object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8532 static int gs_load P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8533 static void gs_clear_image P_ ((struct frame *f, struct image *img));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8534
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8535 /* The symbol `postscript' identifying images of this type. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8536
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8537 Lisp_Object Qpostscript;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8538
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8539 /* Keyword symbols. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8540
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8541 Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8542
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8543 /* Indices of image specification fields in gs_format, below. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8544
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8545 enum gs_keyword_index
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8546 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8547 GS_TYPE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8548 GS_PT_WIDTH,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8549 GS_PT_HEIGHT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8550 GS_FILE,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8551 GS_LOADER,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8552 GS_BOUNDING_BOX,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8553 GS_ASCENT,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8554 GS_MARGIN,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8555 GS_RELIEF,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8556 GS_ALGORITHM,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8557 GS_HEURISTIC_MASK,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8558 GS_LAST
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8559 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8560
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8561 /* Vector of image_keyword structures describing the format
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8562 of valid user-defined image specifications. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8563
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8564 static struct image_keyword gs_format[GS_LAST] =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8565 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8566 {":type", IMAGE_SYMBOL_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8567 {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8568 {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8569 {":file", IMAGE_STRING_VALUE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8570 {":loader", IMAGE_FUNCTION_VALUE, 0},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8571 {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1},
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8572 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8573 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8574 {":relief", IMAGE_INTEGER_VALUE, 0},
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8575 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8576 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8577 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8578
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8579 /* Structure describing the image type `ghostscript'. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8580
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8581 static struct image_type gs_type =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8582 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8583 &Qpostscript,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8584 gs_image_p,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8585 gs_load,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8586 gs_clear_image,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8587 NULL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8588 };
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8589
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8590
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8591 /* Free X resources of Ghostscript image IMG which is used on frame F. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8592
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8593 static void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8594 gs_clear_image (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8595 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8596 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8597 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8598 /* IMG->data.ptr_val may contain a recorded colormap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8599 xfree (img->data.ptr_val);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8600 x_clear_image (f, img);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8601 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8602
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8603
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8604 /* Return non-zero if OBJECT is a valid Ghostscript image
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8605 specification. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8606
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8607 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8608 gs_image_p (object)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8609 Lisp_Object object;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8610 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8611 struct image_keyword fmt[GS_LAST];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8612 Lisp_Object tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8613 int i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8614
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8615 bcopy (gs_format, fmt, sizeof fmt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8616
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8617 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8618 || (fmt[GS_ASCENT].count
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8619 && XFASTINT (fmt[GS_ASCENT].value) > 100))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8620 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8621
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8622 /* Bounding box must be a list or vector containing 4 integers. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8623 tem = fmt[GS_BOUNDING_BOX].value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8624 if (CONSP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8625 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8626 for (i = 0; i < 4; ++i, tem = XCDR (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8627 if (!CONSP (tem) || !INTEGERP (XCAR (tem)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8628 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8629 if (!NILP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8630 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8631 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8632 else if (VECTORP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8633 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8634 if (XVECTOR (tem)->size != 4)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8635 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8636 for (i = 0; i < 4; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8637 if (!INTEGERP (XVECTOR (tem)->contents[i]))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8638 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8639 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8640 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8641 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8642
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8643 return 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8644 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8645
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8646
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8647 /* Load Ghostscript image IMG for use on frame F. Value is non-zero
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8648 if successful. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8649
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8650 static int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8651 gs_load (f, img)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8652 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8653 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8654 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8655 char buffer[100];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8656 Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8657 struct gcpro gcpro1, gcpro2;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8658 Lisp_Object frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8659 double in_width, in_height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8660 Lisp_Object pixel_colors = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8661
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8662 /* Compute pixel size of pixmap needed from the given size in the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8663 image specification. Sizes in the specification are in pt. 1 pt
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8664 = 1/72 in, xdpi and ydpi are stored in the frame's X display
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8665 info. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8666 pt_width = image_spec_value (img->spec, QCpt_width, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8667 in_width = XFASTINT (pt_width) / 72.0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8668 img->width = in_width * FRAME_W32_DISPLAY_INFO (f)->resx;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8669 pt_height = image_spec_value (img->spec, QCpt_height, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8670 in_height = XFASTINT (pt_height) / 72.0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8671 img->height = in_height * FRAME_W32_DISPLAY_INFO (f)->resy;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8672
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8673 /* Create the pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8674 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8675 xassert (img->pixmap == 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8676 img->pixmap = XCreatePixmap (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8677 img->width, img->height,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8678 DefaultDepthOfScreen (FRAME_X_SCREEN (f)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8679 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8680
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8681 if (!img->pixmap)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8682 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8683 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8684 return 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8685 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8686
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8687 /* Call the loader to fill the pixmap. It returns a process object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8688 if successful. We do not record_unwind_protect here because
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8689 other places in redisplay like calling window scroll functions
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8690 don't either. Let the Lisp loader use `unwind-protect' instead. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8691 GCPRO2 (window_and_pixmap_id, pixel_colors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8692
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8693 sprintf (buffer, "%lu %lu",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8694 (unsigned long) FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8695 (unsigned long) img->pixmap);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8696 window_and_pixmap_id = build_string (buffer);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8697
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8698 sprintf (buffer, "%lu %lu",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8699 FRAME_FOREGROUND_PIXEL (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8700 FRAME_BACKGROUND_PIXEL (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8701 pixel_colors = build_string (buffer);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8702
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8703 XSETFRAME (frame, f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8704 loader = image_spec_value (img->spec, QCloader, NULL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8705 if (NILP (loader))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8706 loader = intern ("gs-load-image");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8707
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8708 img->data.lisp_val = call6 (loader, frame, img->spec,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8709 make_number (img->width),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8710 make_number (img->height),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8711 window_and_pixmap_id,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8712 pixel_colors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8713 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8714 return PROCESSP (img->data.lisp_val);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8715 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8716
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8717
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8718 /* Kill the Ghostscript process that was started to fill PIXMAP on
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8719 frame F. Called from XTread_socket when receiving an event
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8720 telling Emacs that Ghostscript has finished drawing. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8721
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8722 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8723 x_kill_gs_process (pixmap, f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8724 Pixmap pixmap;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8725 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8726 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8727 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8728 int class, i;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8729 struct image *img;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8730
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8731 /* Find the image containing PIXMAP. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8732 for (i = 0; i < c->used; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8733 if (c->images[i]->pixmap == pixmap)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8734 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8735
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8736 /* Kill the GS process. We should have found PIXMAP in the image
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8737 cache and its image should contain a process object. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8738 xassert (i < c->used);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8739 img = c->images[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8740 xassert (PROCESSP (img->data.lisp_val));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8741 Fkill_process (img->data.lisp_val, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8742 img->data.lisp_val = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8743
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8744 /* On displays with a mutable colormap, figure out the colors
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8745 allocated for the image by looking at the pixels of an XImage for
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8746 img->pixmap. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8747 class = FRAME_W32_DISPLAY_INFO (f)->visual->class;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8748 if (class != StaticColor && class != StaticGray && class != TrueColor)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8749 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8750 XImage *ximg;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8751
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8752 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8753
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8754 /* Try to get an XImage for img->pixmep. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8755 ximg = XGetImage (FRAME_W32_DISPLAY (f), img->pixmap,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8756 0, 0, img->width, img->height, ~0, ZPixmap);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8757 if (ximg)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8758 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8759 int x, y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8760
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8761 /* Initialize the color table. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8762 init_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8763
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8764 /* For each pixel of the image, look its color up in the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8765 color table. After having done so, the color table will
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8766 contain an entry for each color used by the image. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8767 for (y = 0; y < img->height; ++y)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8768 for (x = 0; x < img->width; ++x)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8769 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8770 unsigned long pixel = XGetPixel (ximg, x, y);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8771 lookup_pixel_color (f, pixel);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8772 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8773
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8774 /* Record colors in the image. Free color table and XImage. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8775 img->colors = colors_in_color_table (&img->ncolors);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8776 free_color_table ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8777 XDestroyImage (ximg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8778
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8779 #if 0 /* This doesn't seem to be the case. If we free the colors
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8780 here, we get a BadAccess later in x_clear_image when
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8781 freeing the colors. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8782 /* We have allocated colors once, but Ghostscript has also
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8783 allocated colors on behalf of us. So, to get the
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8784 reference counts right, free them once. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8785 if (img->ncolors)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8786 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8787 Colormap cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8788 XFreeColors (FRAME_W32_DISPLAY (f), cmap,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8789 img->colors, img->ncolors, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8790 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8791 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8792 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8793 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8794 image_error ("Cannot get X image of `%s'; colors will not be freed",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8795 img->spec, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8796
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8797 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8798 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8799 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8800
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8801 #endif /* HAVE_GHOSTSCRIPT */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8802
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8803
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8804 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8805 Window properties
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8806 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8807
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8808 DEFUN ("x-change-window-property", Fx_change_window_property,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8809 Sx_change_window_property, 2, 3, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8810 "Change window property PROP to VALUE on the X window of FRAME.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8811 PROP and VALUE must be strings. FRAME nil or omitted means use the\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8812 selected frame. Value is VALUE.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8813 (prop, value, frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8814 Lisp_Object frame, prop, value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8815 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8816 #if 0 /* MAC_TODO : port window properties to Mac */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8817 struct frame *f = check_x_frame (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8818 Atom prop_atom;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8819
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8820 CHECK_STRING (prop, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8821 CHECK_STRING (value, 2);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8822
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8823 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8824 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8825 XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8826 prop_atom, XA_STRING, 8, PropModeReplace,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8827 XSTRING (value)->data, XSTRING (value)->size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8828
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8829 /* Make sure the property is set when we return. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8830 XFlush (FRAME_W32_DISPLAY (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8831 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8832
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8833 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8834
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8835 return value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8836 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8837
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8838
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8839 DEFUN ("x-delete-window-property", Fx_delete_window_property,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8840 Sx_delete_window_property, 1, 2, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8841 "Remove window property PROP from X window of FRAME.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8842 FRAME nil or omitted means use the selected frame. Value is PROP.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8843 (prop, frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8844 Lisp_Object prop, frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8845 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8846 #if 0 /* MAC_TODO : port window properties to Mac */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8847
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8848 struct frame *f = check_x_frame (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8849 Atom prop_atom;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8850
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8851 CHECK_STRING (prop, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8852 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8853 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8854 XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8855
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8856 /* Make sure the property is removed when we return. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8857 XFlush (FRAME_W32_DISPLAY (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8858 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8859 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8860
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8861 return prop;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8862 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8863
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8864
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8865 DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8866 1, 2, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8867 "Value is the value of window property PROP on FRAME.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8868 If FRAME is nil or omitted, use the selected frame. Value is nil\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8869 if FRAME hasn't a property with name PROP or if PROP has no string\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8870 value.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8871 (prop, frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8872 Lisp_Object prop, frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8873 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8874 #if 0 /* MAC_TODO : port window properties to Mac */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8875
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8876 struct frame *f = check_x_frame (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8877 Atom prop_atom;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8878 int rc;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8879 Lisp_Object prop_value = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8880 char *tmp_data = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8881 Atom actual_type;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8882 int actual_format;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8883 unsigned long actual_size, bytes_remaining;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8884
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8885 CHECK_STRING (prop, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8886 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8887 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8888 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8889 prop_atom, 0, 0, False, XA_STRING,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8890 &actual_type, &actual_format, &actual_size,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8891 &bytes_remaining, (unsigned char **) &tmp_data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8892 if (rc == Success)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8893 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8894 int size = bytes_remaining;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8895
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8896 XFree (tmp_data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8897 tmp_data = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8898
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8899 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8900 prop_atom, 0, bytes_remaining,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8901 False, XA_STRING,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8902 &actual_type, &actual_format,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8903 &actual_size, &bytes_remaining,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8904 (unsigned char **) &tmp_data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8905 if (rc == Success)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8906 prop_value = make_string (tmp_data, size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8907
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8908 XFree (tmp_data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8909 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8910
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8911 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8912
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8913 return prop_value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8914
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8915 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8916 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8917 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8918
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8919
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8920
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8921 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8922 Busy cursor
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8923 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8924
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8925 /* If non-null, an asynchronous timer that, when it expires, displays
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8926 an hourglass cursor on all frames. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8927
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8928 static struct atimer *hourglass_atimer;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8929
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8930 /* Non-zero means an hourglass cursor is currently shown. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8931
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8932 static int hourglass_shown_p;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8933
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8934 /* Number of seconds to wait before displaying an hourglass cursor. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8935
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8936 static Lisp_Object Vhourglass_delay;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8937
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8938 /* Default number of seconds to wait before displaying an hourglass
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8939 cursor. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8940
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8941 #define DEFAULT_HOURGLASS_DELAY 1
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8942
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8943 /* Function prototypes. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8944
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8945 static void show_hourglass P_ ((struct atimer *));
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8946 static void hide_hourglass P_ ((void));
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8947
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8948
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8949 /* Cancel a currently active hourglass timer, and start a new one. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8950
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8951 void
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8952 start_hourglass ()
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8953 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8954 #if 0 /* TODO: cursor shape changes. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8955 EMACS_TIME delay;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8956 int secs, usecs = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8957
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8958 cancel_hourglass ();
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8959
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8960 if (INTEGERP (Vhourglass_delay)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8961 && XINT (Vhourglass_delay) > 0)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8962 secs = XFASTINT (Vhourglass_delay);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8963 else if (FLOATP (Vhourglass_delay)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8964 && XFLOAT_DATA (Vhourglass_delay) > 0)
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8965 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8966 Lisp_Object tem;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8967 tem = Ftruncate (Vhourglass_delay, Qnil);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8968 secs = XFASTINT (tem);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8969 usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8970 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8971 else
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8972 secs = DEFAULT_HOURGLASS_DELAY;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8973
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8974 EMACS_SET_SECS_USECS (delay, secs, usecs);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8975 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8976 show_hourglass, NULL);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8977 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8978 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8979
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8980
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8981 /* Cancel the hourglass cursor timer if active, hide an hourglass
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8982 cursor if shown. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8983
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8984 void
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8985 cancel_hourglass ()
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8986 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8987 if (hourglass_atimer)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8988 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8989 cancel_atimer (hourglass_atimer);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8990 hourglass_atimer = NULL;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8991 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
8992
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8993 if (hourglass_shown_p)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8994 hide_hourglass ();
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8995 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8996
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8997
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8998 /* Timer function of hourglass_atimer. TIMER is equal to
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
8999 hourglass_atimer.
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9000
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9001 Display an hourglass cursor on all frames by mapping the frames'
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9002 hourglass_window. Set the hourglass_p flag in the frames'
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9003 output_data.x structure to indicate that an hourglass cursor is
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9004 shown on the frames. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9005
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9006 static void
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9007 show_hourglass (timer)
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9008 struct atimer *timer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9009 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9010 #if 0 /* MAC_TODO: cursor shape changes. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9011 /* The timer implementation will cancel this timer automatically
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9012 after this function has run. Set hourglass_atimer to null
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9013 so that we know the timer doesn't have to be canceled. */
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9014 hourglass_atimer = NULL;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9015
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9016 if (!hourglass_shown_p)
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9017 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9018 Lisp_Object rest, frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9019
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9020 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9021
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9022 FOR_EACH_FRAME (rest, frame)
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9023 if (FRAME_W32_P (XFRAME (frame)))
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9024 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9025 struct frame *f = XFRAME (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9026
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9027 f->output_data.w32->hourglass_p = 1;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9028
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9029 if (!f->output_data.w32->hourglass_window)
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9030 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9031 unsigned long mask = CWCursor;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9032 XSetWindowAttributes attrs;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9033
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9034 attrs.cursor = f->output_data.w32->hourglass_cursor;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9035
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9036 f->output_data.w32->hourglass_window
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9037 = XCreateWindow (FRAME_X_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9038 FRAME_OUTER_WINDOW (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9039 0, 0, 32000, 32000, 0, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9040 InputOnly,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9041 CopyFromParent,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9042 mask, &attrs);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9043 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9044
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9045 XMapRaised (FRAME_X_DISPLAY (f),
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9046 f->output_data.w32->hourglass_window);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9047 XFlush (FRAME_X_DISPLAY (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9048 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9049
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9050 hourglass_shown_p = 1;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9051 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9052 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9053 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9054 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9055
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9056
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9057 /* Hide the hourglass cursor on all frames, if it is currently shown. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9058
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9059 static void
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9060 hide_hourglass ()
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9061 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9062 #if 0 /* TODO: cursor shape changes. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9063 if (hourglass_shown_p)
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9064 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9065 Lisp_Object rest, frame;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9066
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9067 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9068 FOR_EACH_FRAME (rest, frame)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9069 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9070 struct frame *f = XFRAME (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9071
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9072 if (FRAME_W32_P (f)
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9073 /* Watch out for newly created frames. */
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9074 && f->output_data.x->hourglass_window)
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9075 {
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9076 XUnmapWindow (FRAME_X_DISPLAY (f),
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9077 f->output_data.x->hourglass_window);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9078 /* Sync here because XTread_socket looks at the
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9079 hourglass_p flag that is reset to zero below. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9080 XSync (FRAME_X_DISPLAY (f), False);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9081 f->output_data.x->hourglass_p = 0;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9082 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9083 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9084
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9085 hourglass_shown_p = 0;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9086 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9087 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9088 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9089 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9090
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9091
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9092
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9093 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9094 Tool tips
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9095 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9096
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9097 static Lisp_Object x_create_tip_frame P_ ((struct w32_display_info *,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9098 Lisp_Object));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9099
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9100 /* The frame of a currently visible tooltip, or null. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9101
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9102 Lisp_Object tip_frame;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9103
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9104 /* If non-nil, a timer started that hides the last tooltip when it
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9105 fires. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9106
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9107 Lisp_Object tip_timer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9108 Window tip_window;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9109
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9110 /* Create a frame for a tooltip on the display described by DPYINFO.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9111 PARMS is a list of frame parameters. Value is the frame. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9112
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9113 static Lisp_Object
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9114 x_create_tip_frame (dpyinfo, parms)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9115 struct w32_display_info *dpyinfo;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9116 Lisp_Object parms;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9117 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9118 #if 0 /* MAC_TODO : Mac version */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9119 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9120 Lisp_Object frame, tem;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9121 Lisp_Object name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9122 long window_prompting = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9123 int width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9124 int count = specpdl_ptr - specpdl;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9125 struct gcpro gcpro1, gcpro2, gcpro3;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9126 struct kboard *kb;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9127
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9128 check_x ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9129
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9130 /* Use this general default value to start with until we know if
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9131 this frame has a specified name. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9132 Vx_resource_name = Vinvocation_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9133
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9134 #ifdef MULTI_KBOARD
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9135 kb = dpyinfo->kboard;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9136 #else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9137 kb = &the_only_kboard;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9138 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9139
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9140 /* Get the name of the frame to use for resource lookup. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9141 name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9142 if (!STRINGP (name)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9143 && !EQ (name, Qunbound)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9144 && !NILP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9145 error ("Invalid frame name--not a string or nil");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9146 Vx_resource_name = name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9147
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9148 frame = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9149 GCPRO3 (parms, name, frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9150 tip_frame = f = make_frame (1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9151 XSETFRAME (frame, f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9152 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9153
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9154 f->output_method = output_w32;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9155 f->output_data.w32 =
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9156 (struct w32_output *) xmalloc (sizeof (struct w32_output));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9157 bzero (f->output_data.w32, sizeof (struct w32_output));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9158 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9159 f->output_data.w32->icon_bitmap = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9160 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9161 f->output_data.w32->fontset = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9162 f->icon_name = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9163
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9164 #ifdef MULTI_KBOARD
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9165 FRAME_KBOARD (f) = kb;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9166 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9167 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9168 f->output_data.w32->explicit_parent = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9169
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9170 /* Set the name; the functions to which we pass f expect the name to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9171 be set. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9172 if (EQ (name, Qunbound) || NILP (name))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9173 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9174 f->name = build_string (dpyinfo->x_id_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9175 f->explicit_name = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9176 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9177 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9178 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9179 f->name = name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9180 f->explicit_name = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9181 /* use the frame's title when getting resources for this frame. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9182 specbind (Qx_resource_name, name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9183 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9184
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9185 /* Extract the window parameters from the supplied values
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9186 that are needed to determine window geometry. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9187 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9188 Lisp_Object font;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9189
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9190 font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9191
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9192 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9193 /* First, try whatever font the caller has specified. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9194 if (STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9195 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9196 tem = Fquery_fontset (font, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9197 if (STRINGP (tem))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9198 font = x_new_fontset (f, XSTRING (tem)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9199 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9200 font = x_new_font (f, XSTRING (font)->data);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9201 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9202
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9203 /* Try out a font which we hope has bold and italic variations. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9204 if (!STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9205 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9206 if (!STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9207 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9208 if (! STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9209 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9210 if (! STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9211 /* This was formerly the first thing tried, but it finds too many fonts
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9212 and takes too long. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9213 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9214 /* If those didn't work, look for something which will at least work. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9215 if (! STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9216 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9217 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9218 if (! STRINGP (font))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9219 font = build_string ("fixed");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9220
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9221 x_default_parameter (f, parms, Qfont, font,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9222 "font", "Font", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9223 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9224
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9225 x_default_parameter (f, parms, Qborder_width, make_number (2),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9226 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9227
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9228 /* This defaults to 2 in order to match xterm. We recognize either
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9229 internalBorderWidth or internalBorder (which is what xterm calls
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9230 it). */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9231 if (NILP (Fassq (Qinternal_border_width, parms)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9232 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9233 Lisp_Object value;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9234
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9235 value = w32_get_arg (parms, Qinternal_border_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9236 "internalBorder", "internalBorder", RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9237 if (! EQ (value, Qunbound))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9238 parms = Fcons (Fcons (Qinternal_border_width, value),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9239 parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9240 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9241
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9242 x_default_parameter (f, parms, Qinternal_border_width, make_number (1),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9243 "internalBorderWidth", "internalBorderWidth",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9244 RES_TYPE_NUMBER);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9245
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9246 /* Also do the stuff which must be set before the window exists. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9247 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9248 "foreground", "Foreground", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9249 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9250 "background", "Background", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9251 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9252 "pointerColor", "Foreground", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9253 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9254 "cursorColor", "Foreground", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9255 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9256 "borderColor", "BorderColor", RES_TYPE_STRING);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9257
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9258 /* Init faces before x_default_parameter is called for scroll-bar
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9259 parameters because that function calls x_set_scroll_bar_width,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9260 which calls change_frame_size, which calls Fset_window_buffer,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9261 which runs hooks, which call Fvertical_motion. At the end, we
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9262 end up in init_iterator with a null face cache, which should not
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9263 happen. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9264 init_frame_faces (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9265
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9266 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9267 window_prompting = x_figure_window_size (f, parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9268
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9269 if (window_prompting & XNegative)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9270 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9271 if (window_prompting & YNegative)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9272 f->output_data.w32->win_gravity = SouthEastGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9273 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9274 f->output_data.w32->win_gravity = NorthEastGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9275 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9276 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9277 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9278 if (window_prompting & YNegative)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9279 f->output_data.w32->win_gravity = SouthWestGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9280 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9281 f->output_data.w32->win_gravity = NorthWestGravity;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9282 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9283
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9284 f->output_data.w32->size_hint_flags = window_prompting;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9285 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9286 XSetWindowAttributes attrs;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9287 unsigned long mask;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9288
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9289 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9290 mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9291 /* Window managers looks at the override-redirect flag to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9292 determine whether or net to give windows a decoration (Xlib
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9293 3.2.8). */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9294 attrs.override_redirect = True;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9295 attrs.save_under = True;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9296 attrs.background_pixel = FRAME_BACKGROUND_PIXEL (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9297 /* Arrange for getting MapNotify and UnmapNotify events. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9298 attrs.event_mask = StructureNotifyMask;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9299 tip_window
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9300 = FRAME_W32_WINDOW (f)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9301 = XCreateWindow (FRAME_W32_DISPLAY (f),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9302 FRAME_W32_DISPLAY_INFO (f)->root_window,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9303 /* x, y, width, height */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9304 0, 0, 1, 1,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9305 /* Border. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9306 1,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9307 CopyFromParent, InputOutput, CopyFromParent,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9308 mask, &attrs);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9309 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9310 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9311
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9312 x_make_gc (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9313
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9314 x_default_parameter (f, parms, Qauto_raise, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9315 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9316 x_default_parameter (f, parms, Qauto_lower, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9317 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9318 x_default_parameter (f, parms, Qcursor_type, Qbox,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9319 "cursorType", "CursorType", RES_TYPE_SYMBOL);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9320
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9321 /* Dimensions, especially f->height, must be done via change_frame_size.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9322 Change will not be effected unless different from the current
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9323 f->height. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9324 width = f->width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9325 height = f->height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9326 f->height = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9327 SET_FRAME_WIDTH (f, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9328 change_frame_size (f, height, width, 1, 0, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9329
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9330 f->no_split = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9331
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9332 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9333
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9334 /* It is now ok to make the frame official even if we get an error
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9335 below. And the frame needs to be on Vframe_list or making it
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9336 visible won't work. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9337 Vframe_list = Fcons (frame, Vframe_list);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9338
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9339 /* Now that the frame is official, it counts as a reference to
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9340 its display. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9341 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9342
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9343 return unbind_to (count, frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9344 #endif /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9345 return Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9346 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9347
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9348 #ifdef TODO /* Tooltip support not complete. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9349 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9350 "Show STRING in a \"tooltip\" window on frame FRAME.\n\
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9351 A tooltip window is a small window displaying a string.\n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9352 \n\
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9353 FRAME nil or omitted means use the selected frame.\n\
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9354 \n\
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9355 PARMS is an optional list of frame parameters which can be\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9356 used to change the tooltip's appearance.\n\
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9357 \n\
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9358 Automatically hide the tooltip after TIMEOUT seconds.\n\
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9359 TIMEOUT nil means use the default timeout of 5 seconds.\n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9360 \n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9361 If the list of frame parameters PARAMS contains a `left' parameters,\n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9362 the tooltip is displayed at that x-position. Otherwise it is\n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9363 displayed at the mouse position, with offset DX added (default is 5 if\n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9364 DX isn't specified). Likewise for the y-position; if a `top' frame\n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9365 parameter is specified, it determines the y-position of the tooltip\n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9366 window, otherwise it is displayed at the mouse position, with offset\n\
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9367 DY added (default is 10).")
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9368 (string, frame, parms, timeout, dx, dy)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9369 Lisp_Object string, frame, parms, timeout, dx, dy;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9370 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9371 struct frame *f;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9372 struct window *w;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9373 Window root, child;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9374 Lisp_Object buffer, top, left;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9375 struct buffer *old_buffer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9376 struct text_pos pos;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9377 int i, width, height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9378 int root_x, root_y, win_x, win_y;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9379 unsigned pmask;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9380 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9381 int old_windows_or_buffers_changed = windows_or_buffers_changed;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9382 int count = specpdl_ptr - specpdl;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9383
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9384 specbind (Qinhibit_redisplay, Qt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9385
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9386 GCPRO4 (string, parms, frame, timeout);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9387
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9388 CHECK_STRING (string, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9389 f = check_x_frame (frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9390 if (NILP (timeout))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9391 timeout = make_number (5);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9392 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9393 CHECK_NATNUM (timeout, 2);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9394
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9395 if (NILP (dx))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9396 dx = make_number (5);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9397 else
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9398 CHECK_NUMBER (dx, 5);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9399
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9400 if (NILP (dy))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9401 dy = make_number (-10);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9402 else
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9403 CHECK_NUMBER (dy, 6);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9404
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9405 if (NILP (last_show_tip_args))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9406 last_show_tip_args = Fmake_vector (make_number (3), Qnil);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9407
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9408 if (!NILP (tip_frame))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9409 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9410 Lisp_Object last_string = AREF (last_show_tip_args, 0);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9411 Lisp_Object last_frame = AREF (last_show_tip_args, 1);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9412 Lisp_Object last_parms = AREF (last_show_tip_args, 2);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9413
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9414 if (EQ (frame, last_frame)
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9415 && !NILP (Fequal (last_string, string))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9416 && !NILP (Fequal (last_parms, parms)))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9417 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9418 struct frame *f = XFRAME (tip_frame);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9419
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9420 /* Only DX and DY have changed. */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9421 if (!NILP (tip_timer))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9422 {
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9423 Lisp_Object timer = tip_timer;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9424 tip_timer = Qnil;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9425 call1 (Qcancel_timer, timer);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9426 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9427
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9428 BLOCK_INPUT;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9429 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9430 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9431 root_x, root_y - PIXEL_HEIGHT (f));
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9432 UNBLOCK_INPUT;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9433 goto start_timer;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9434 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9435 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9436
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9437 /* Hide a previous tip, if any. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9438 Fx_hide_tip ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9439
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9440 ASET (last_show_tip_args, 0, string);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9441 ASET (last_show_tip_args, 1, frame);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9442 ASET (last_show_tip_args, 2, parms);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9443
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9444 /* Add default values to frame parameters. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9445 if (NILP (Fassq (Qname, parms)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9446 parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9447 if (NILP (Fassq (Qinternal_border_width, parms)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9448 parms = Fcons (Fcons (Qinternal_border_width, make_number (3)), parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9449 if (NILP (Fassq (Qborder_width, parms)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9450 parms = Fcons (Fcons (Qborder_width, make_number (1)), parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9451 if (NILP (Fassq (Qborder_color, parms)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9452 parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9453 if (NILP (Fassq (Qbackground_color, parms)))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9454 parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9455 parms);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9456
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9457 /* Create a frame for the tooltip, and record it in the global
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9458 variable tip_frame. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9459 frame = x_create_tip_frame (FRAME_MAC_DISPLAY_INFO (f), parms);
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9460 f = XFRAME (frame);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9461
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9462 /* Set up the frame's root window. Currently we use a size of 80
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9463 columns x 40 lines. If someone wants to show a larger tip, he
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9464 will loose. I don't think this is a realistic case. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9465 w = XWINDOW (FRAME_ROOT_WINDOW (f));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9466 w->left = w->top = make_number (0);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9467 w->width = make_number (80);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9468 w->height = make_number (40);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9469 adjust_glyphs (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9470 w->pseudo_window_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9471
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9472 /* Display the tooltip text in a temporary buffer. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9473 buffer = Fget_buffer_create (build_string (" *tip*"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9474 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9475 old_buffer = current_buffer;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9476 set_buffer_internal_1 (XBUFFER (buffer));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9477 Ferase_buffer ();
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9478 Finsert (1, &string);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9479 clear_glyph_matrix (w->desired_matrix);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9480 clear_glyph_matrix (w->current_matrix);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9481 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9482 try_window (FRAME_ROOT_WINDOW (f), pos);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9483
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9484 /* Compute width and height of the tooltip. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9485 width = height = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9486 for (i = 0; i < w->desired_matrix->nrows; ++i)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9487 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9488 struct glyph_row *row = &w->desired_matrix->rows[i];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9489 struct glyph *last;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9490 int row_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9491
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9492 /* Stop at the first empty row at the end. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9493 if (!row->enabled_p || !row->displays_text_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9494 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9495
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9496 /* Let the row go over the full width of the frame. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9497 row->full_width_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9498
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9499 /* There's a glyph at the end of rows that is use to place
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9500 the cursor there. Don't include the width of this glyph. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9501 if (row->used[TEXT_AREA])
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9502 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9503 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9504 row_width = row->pixel_width - last->pixel_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9505 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9506 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9507 row_width = row->pixel_width;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9508
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9509 height += row->height;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9510 width = max (width, row_width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9511 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9512
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9513 /* Add the frame's internal border to the width and height the X
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9514 window should have. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9515 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9516 width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9517
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9518 /* Move the tooltip window where the mouse pointer is. Resize and
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9519 show it. */
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9520 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9521
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9522 #if 0 /* TODO : Mac specifics */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9523 BLOCK_INPUT;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9524 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9525 root_x, root_y - height, width, height);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9526 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9527 UNBLOCK_INPUT;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9528 #endif /* TODO */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9529
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9530 /* Draw into the window. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9531 w->must_be_updated_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9532 update_single_window (w, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9533
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9534 /* Restore original current buffer. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9535 set_buffer_internal_1 (old_buffer);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9536 windows_or_buffers_changed = old_windows_or_buffers_changed;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9537
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9538 start_timer:
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9539 /* Let the tip disappear after timeout seconds. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9540 tip_timer = call3 (intern ("run-at-time"), timeout, Qnil,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9541 intern ("x-hide-tip"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9542
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9543 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9544 return unbind_to (count, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9545 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9546
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9547
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9548 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9549 "Hide the current tooltip window, if there is any.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9550 Value is t is tooltip was open, nil otherwise.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9551 ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9552 {
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9553 int count;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9554 Lisp_Object deleted, frame, timer;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9555 struct gcpro gcpro1, gcpro2;
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9556
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9557 /* Return quickly if nothing to do. */
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9558 if (NILP (tip_timer) && NILP (tip_frame))
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9559 return Qnil;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9560
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9561 frame = tip_frame;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9562 timer = tip_timer;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9563 GCPRO2 (frame, timer);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9564 tip_frame = tip_timer = deleted = Qnil;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9565
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9566 count = BINDING_STACK_SIZE ();
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9567 specbind (Qinhibit_redisplay, Qt);
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9568 specbind (Qinhibit_quit, Qt);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9569
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9570 if (!NILP (timer))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9571 call1 (Qcancel_timer, timer);
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9572
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9573 if (FRAMEP (frame))
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9574 {
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9575 Fdelete_frame (frame, Qnil);
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9576 deleted = Qt;
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9577 }
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9578
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9579 UNGCPRO;
34465
94435b0ce7fd * src/macfns.c (x_create_tip_frame, Fx_hide_tip): change to handle
Andrew Choi <akochoi@shaw.ca>
parents: 32752
diff changeset
9580 return unbind_to (count, deleted);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9581 }
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9582 #endif
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9583
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9584
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9585
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9586 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9587 File selection dialog
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9588 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9589
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9590 #if 0 /* MAC_TODO: can standard file dialog */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9591 extern Lisp_Object Qfile_name_history;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9592
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9593 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9594 "Read file name, prompting with PROMPT in directory DIR.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9595 Use a file selection dialog.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9596 Select DEFAULT-FILENAME in the dialog's file selection box, if\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9597 specified. Don't let the user enter a file name in the file\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9598 selection dialog's entry field, if MUSTMATCH is non-nil.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9599 (prompt, dir, default_filename, mustmatch)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9600 Lisp_Object prompt, dir, default_filename, mustmatch;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9601 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9602 struct frame *f = SELECTED_FRAME ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9603 Lisp_Object file = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9604 int count = specpdl_ptr - specpdl;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9605 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9606 char filename[MAX_PATH + 1];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9607 char init_dir[MAX_PATH + 1];
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9608 int use_dialog_p = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9609
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9610 GCPRO5 (prompt, dir, default_filename, mustmatch, file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9611 CHECK_STRING (prompt, 0);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9612 CHECK_STRING (dir, 1);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9613
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9614 /* Create the dialog with PROMPT as title, using DIR as initial
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9615 directory and using "*" as pattern. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9616 dir = Fexpand_file_name (dir, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9617 strncpy (init_dir, XSTRING (dir)->data, MAX_PATH);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9618 init_dir[MAX_PATH] = '\0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9619 unixtodos_filename (init_dir);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9620
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9621 if (STRINGP (default_filename))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9622 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9623 char *file_name_only;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9624 char *full_path_name = XSTRING (default_filename)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9625
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9626 unixtodos_filename (full_path_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9627
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9628 file_name_only = strrchr (full_path_name, '\\');
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9629 if (!file_name_only)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9630 file_name_only = full_path_name;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9631 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9632 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9633 file_name_only++;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9634
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9635 /* If default_file_name is a directory, don't use the open
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9636 file dialog, as it does not support selecting
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9637 directories. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9638 if (!(*file_name_only))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9639 use_dialog_p = 0;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9640 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9641
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9642 strncpy (filename, file_name_only, MAX_PATH);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9643 filename[MAX_PATH] = '\0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9644 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9645 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9646 filename[0] = '\0';
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9647
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9648 if (use_dialog_p)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9649 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9650 OPENFILENAME file_details;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9651 char *filename_file;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9652
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9653 /* Prevent redisplay. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9654 specbind (Qinhibit_redisplay, Qt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9655 BLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9656
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9657 bzero (&file_details, sizeof (file_details));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9658 file_details.lStructSize = sizeof (file_details);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9659 file_details.hwndOwner = FRAME_W32_WINDOW (f);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9660 file_details.lpstrFile = filename;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9661 file_details.nMaxFile = sizeof (filename);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9662 file_details.lpstrInitialDir = init_dir;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9663 file_details.lpstrTitle = XSTRING (prompt)->data;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9664 file_details.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9665
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9666 if (!NILP (mustmatch))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9667 file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9668
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9669 if (GetOpenFileName (&file_details))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9670 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9671 dostounix_filename (filename);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9672 file = build_string (filename);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9673 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9674 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9675 file = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9676
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9677 UNBLOCK_INPUT;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9678 file = unbind_to (count, file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9679 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9680 /* Open File dialog will not allow folders to be selected, so resort
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9681 to minibuffer completing reads for directories. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9682 else
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9683 file = Fcompleting_read (prompt, intern ("read-file-name-internal"),
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9684 dir, mustmatch, dir, Qfile_name_history,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9685 default_filename, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9686
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9687 UNGCPRO;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9688
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9689 /* Make "Cancel" equivalent to C-g. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9690 if (NILP (file))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9691 Fsignal (Qquit, Qnil);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9692
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9693 return unbind_to (count, file);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9694 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9695 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9696
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9697
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9698
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9699 /***********************************************************************
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9700 Tests
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9701 ***********************************************************************/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9702
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9703 #if GLYPH_DEBUG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9704
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9705 DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9706 "Value is non-nil if SPEC is a valid image specification.")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9707 (spec)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9708 Lisp_Object spec;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9709 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9710 return valid_image_p (spec) ? Qt : Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9711 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9712
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9713
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9714 DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "")
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9715 (spec)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9716 Lisp_Object spec;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9717 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9718 int id = -1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9719
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9720 if (valid_image_p (spec))
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9721 id = lookup_image (SELECTED_FRAME (), spec);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9722
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9723 debug_print (spec);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9724 return make_number (id);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9725 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9726
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9727 #endif /* GLYPH_DEBUG != 0 */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9728
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9729
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9730
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9731 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9732 syms_of_macfns ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9733 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9734 /* Certainly running on Mac. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9735 mac_in_use = 1;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9736
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9737 /* The section below is built by the lisp expression at the top of the file,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9738 just above where these variables are declared. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9739 /*&&& init symbols here &&&*/
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9740 Qauto_raise = intern ("auto-raise");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9741 staticpro (&Qauto_raise);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9742 Qauto_lower = intern ("auto-lower");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9743 staticpro (&Qauto_lower);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9744 Qbar = intern ("bar");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9745 staticpro (&Qbar);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9746 Qborder_color = intern ("border-color");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9747 staticpro (&Qborder_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9748 Qborder_width = intern ("border-width");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9749 staticpro (&Qborder_width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9750 Qbox = intern ("box");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9751 staticpro (&Qbox);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9752 Qcursor_color = intern ("cursor-color");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9753 staticpro (&Qcursor_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9754 Qcursor_type = intern ("cursor-type");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9755 staticpro (&Qcursor_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9756 Qgeometry = intern ("geometry");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9757 staticpro (&Qgeometry);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9758 Qicon_left = intern ("icon-left");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9759 staticpro (&Qicon_left);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9760 Qicon_top = intern ("icon-top");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9761 staticpro (&Qicon_top);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9762 Qicon_type = intern ("icon-type");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9763 staticpro (&Qicon_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9764 Qicon_name = intern ("icon-name");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9765 staticpro (&Qicon_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9766 Qinternal_border_width = intern ("internal-border-width");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9767 staticpro (&Qinternal_border_width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9768 Qleft = intern ("left");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9769 staticpro (&Qleft);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9770 Qright = intern ("right");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9771 staticpro (&Qright);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9772 Qmouse_color = intern ("mouse-color");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9773 staticpro (&Qmouse_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9774 Qnone = intern ("none");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9775 staticpro (&Qnone);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9776 Qparent_id = intern ("parent-id");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9777 staticpro (&Qparent_id);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9778 Qscroll_bar_width = intern ("scroll-bar-width");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9779 staticpro (&Qscroll_bar_width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9780 Qsuppress_icon = intern ("suppress-icon");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9781 staticpro (&Qsuppress_icon);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9782 Qundefined_color = intern ("undefined-color");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9783 staticpro (&Qundefined_color);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9784 Qvertical_scroll_bars = intern ("vertical-scroll-bars");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9785 staticpro (&Qvertical_scroll_bars);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9786 Qvisibility = intern ("visibility");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9787 staticpro (&Qvisibility);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9788 Qwindow_id = intern ("window-id");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9789 staticpro (&Qwindow_id);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9790 Qx_frame_parameter = intern ("x-frame-parameter");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9791 staticpro (&Qx_frame_parameter);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9792 Qx_resource_name = intern ("x-resource-name");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9793 staticpro (&Qx_resource_name);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9794 Quser_position = intern ("user-position");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9795 staticpro (&Quser_position);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9796 Quser_size = intern ("user-size");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9797 staticpro (&Quser_size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9798 Qscreen_gamma = intern ("screen-gamma");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9799 staticpro (&Qscreen_gamma);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9800 Qline_spacing = intern ("line-spacing");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9801 staticpro (&Qline_spacing);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9802 Qcenter = intern ("center");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9803 staticpro (&Qcenter);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9804 Qcancel_timer = intern ("cancel-timer");
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9805 staticpro (&Qcancel_timer);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9806 /* This is the end of symbol initialization. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9807
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9808 Qhyper = intern ("hyper");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9809 staticpro (&Qhyper);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9810 Qsuper = intern ("super");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9811 staticpro (&Qsuper);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9812 Qmeta = intern ("meta");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9813 staticpro (&Qmeta);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9814 Qalt = intern ("alt");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9815 staticpro (&Qalt);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9816 Qctrl = intern ("ctrl");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9817 staticpro (&Qctrl);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9818 Qcontrol = intern ("control");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9819 staticpro (&Qcontrol);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9820 Qshift = intern ("shift");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9821 staticpro (&Qshift);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9822
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9823 /* Text property `display' should be nonsticky by default. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9824 Vtext_property_default_nonsticky
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9825 = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9826
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9827
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9828 Qlaplace = intern ("laplace");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9829 staticpro (&Qlaplace);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9830
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9831 Qface_set_after_frame_default = intern ("face-set-after-frame-default");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9832 staticpro (&Qface_set_after_frame_default);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9833
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9834 Fput (Qundefined_color, Qerror_conditions,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9835 Fcons (Qundefined_color, Fcons (Qerror, Qnil)));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9836 Fput (Qundefined_color, Qerror_message,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9837 build_string ("Undefined color"));
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9838
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9839 init_x_parm_symbols ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9840
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9841 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9842 "List of directories to search for bitmap files for w32.");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9843 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9844
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9845 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9846 "The shape of the pointer when over text.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9847 Changing the value does not affect existing frames\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9848 unless you set the mouse color.");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9849 Vx_pointer_shape = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9850
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9851 DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9852 "The name Emacs uses to look up resources; for internal use only.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9853 `x-get-resource' uses this as the first component of the instance name\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9854 when requesting resource values.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9855 Emacs initially sets `x-resource-name' to the name under which Emacs\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9856 was invoked, or to the value specified with the `-name' or `-rn'\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9857 switches, if present.");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9858 Vx_resource_name = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9859
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9860 Vx_nontext_pointer_shape = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9861
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9862 Vx_mode_pointer_shape = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9863
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9864 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape,
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9865 "The shape of the pointer when Emacs is busy.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9866 This variable takes effect when you create a new frame\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9867 or when you set the mouse color.");
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9868 Vx_hourglass_pointer_shape = Qnil;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9869
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9870 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9871 "Non-zero means Emacs displays an hourglass pointer on window systems.");
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9872 display_hourglass_p = 1;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9873
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9874 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9875 "*Seconds to wait before displaying an hourglass pointer.\n\
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9876 Value must be an integer or float.");
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
9877 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9878
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9879 DEFVAR_LISP ("x-sensitive-text-pointer-shape",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9880 &Vx_sensitive_text_pointer_shape,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9881 "The shape of the pointer when over mouse-sensitive text.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9882 This variable takes effect when you create a new frame\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9883 or when you set the mouse color.");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9884 Vx_sensitive_text_pointer_shape = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9885
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9886 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9887 "A string indicating the foreground color of the cursor box.");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9888 Vx_cursor_fore_pixel = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9889
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9890 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9891 "Non-nil if no window manager is in use.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9892 Emacs doesn't try to figure this out; this is always nil\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9893 unless you set it to something else.");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9894 /* We don't have any way to find this out, so set it to nil
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9895 and maybe the user would like to set it to t. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9896 Vx_no_window_manager = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9897
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9898 DEFVAR_LISP ("x-pixel-size-width-font-regexp",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9899 &Vx_pixel_size_width_font_regexp,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9900 "Regexp matching a font name whose width is the same as `PIXEL_SIZE'.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9901 \n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9902 Since Emacs gets width of a font matching with this regexp from\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9903 PIXEL_SIZE field of the name, font finding mechanism gets faster for\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9904 such a font. This is especially effective for such large fonts as\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9905 Chinese, Japanese, and Korean.");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9906 Vx_pixel_size_width_font_regexp = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9907
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9908 DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9909 "Time after which cached images are removed from the cache.\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9910 When an image has not been displayed this many seconds, remove it\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9911 from the image cache. Value must be an integer or nil with nil\n\
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9912 meaning don't clear the cache.");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9913 Vimage_cache_eviction_delay = make_number (30 * 60);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9914
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9915 #if 0 /* MAC_TODO: implement get X resource */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9916 defsubr (&Sx_get_resource);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9917 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9918 defsubr (&Sx_change_window_property);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9919 defsubr (&Sx_delete_window_property);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9920 defsubr (&Sx_window_property);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9921 defsubr (&Sxw_display_color_p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9922 defsubr (&Sx_display_grayscale_p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9923 defsubr (&Sxw_color_defined_p);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9924 defsubr (&Sxw_color_values);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9925 defsubr (&Sx_server_max_request_size);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9926 defsubr (&Sx_server_vendor);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9927 defsubr (&Sx_server_version);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9928 defsubr (&Sx_display_pixel_width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9929 defsubr (&Sx_display_pixel_height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9930 defsubr (&Sx_display_mm_width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9931 defsubr (&Sx_display_mm_height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9932 defsubr (&Sx_display_screens);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9933 defsubr (&Sx_display_planes);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9934 defsubr (&Sx_display_color_cells);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9935 defsubr (&Sx_display_visual_class);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9936 defsubr (&Sx_display_backing_store);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9937 defsubr (&Sx_display_save_under);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9938 #if 0 /* MAC_TODO: implement XParseGeometry */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9939 defsubr (&Sx_parse_geometry);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9940 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9941 defsubr (&Sx_create_frame);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9942 #if 0 /* MAC_TODO: implement network support */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9943 defsubr (&Sx_open_connection);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9944 defsubr (&Sx_close_connection);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9945 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9946 defsubr (&Sx_display_list);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9947 defsubr (&Sx_synchronize);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9948
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9949 /* Setting callback functions for fontset handler. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9950 get_font_info_func = x_get_font_info;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9951
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9952 #if 0 /* This function pointer doesn't seem to be used anywhere.
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9953 And the pointer assigned has the wrong type, anyway. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9954 list_fonts_func = x_list_fonts;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9955 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9956
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9957 load_font_func = x_load_font;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9958 find_ccl_program_func = x_find_ccl_program;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9959 query_font_func = x_query_font;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9960
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9961 set_frame_fontset_func = x_set_font;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9962 check_window_system_func = check_mac;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9963
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9964 #if 0 /* MAC_TODO: Image support for Mac Images. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9965 Qxbm = intern ("xbm");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9966 staticpro (&Qxbm);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9967 QCtype = intern (":type");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9968 staticpro (&QCtype);
35660
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
9969 QCconversion = intern (":conversion");
b9366f467430 * alloc.c (allocate_string) [macintosh]: Call check_string_bytes
Andrew Choi <akochoi@shaw.ca>
parents: 34465
diff changeset
9970 staticpro (&QCconversion);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9971 QCheuristic_mask = intern (":heuristic-mask");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9972 staticpro (&QCheuristic_mask);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9973 QCcolor_symbols = intern (":color-symbols");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9974 staticpro (&QCcolor_symbols);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9975 QCascent = intern (":ascent");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9976 staticpro (&QCascent);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9977 QCmargin = intern (":margin");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9978 staticpro (&QCmargin);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9979 QCrelief = intern (":relief");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9980 staticpro (&QCrelief);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9981 Qpostscript = intern ("postscript");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9982 staticpro (&Qpostscript);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9983 QCloader = intern (":loader");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9984 staticpro (&QCloader);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9985 QCbounding_box = intern (":bounding-box");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9986 staticpro (&QCbounding_box);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9987 QCpt_width = intern (":pt-width");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9988 staticpro (&QCpt_width);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9989 QCpt_height = intern (":pt-height");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9990 staticpro (&QCpt_height);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9991 QCindex = intern (":index");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9992 staticpro (&QCindex);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9993 Qpbm = intern ("pbm");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9994 staticpro (&Qpbm);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9995
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9996 #if HAVE_XPM
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9997 Qxpm = intern ("xpm");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9998 staticpro (&Qxpm);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
9999 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10000
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10001 #if HAVE_JPEG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10002 Qjpeg = intern ("jpeg");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10003 staticpro (&Qjpeg);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10004 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10005
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10006 #if HAVE_TIFF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10007 Qtiff = intern ("tiff");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10008 staticpro (&Qtiff);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10009 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10010
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10011 #if HAVE_GIF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10012 Qgif = intern ("gif");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10013 staticpro (&Qgif);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10014 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10015
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10016 #if HAVE_PNG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10017 Qpng = intern ("png");
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10018 staticpro (&Qpng);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10019 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10020
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10021 defsubr (&Sclear_image_cache);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10022
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10023 #if GLYPH_DEBUG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10024 defsubr (&Simagep);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10025 defsubr (&Slookup_image);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10026 #endif
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10027 #endif /* TODO */
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10028
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10029 hourglass_atimer = NULL;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10030 hourglass_shown_p = 0;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10031 #ifdef TODO /* Tooltip support not complete. */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10032 defsubr (&Sx_show_tip);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10033 defsubr (&Sx_hide_tip);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10034 #endif
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10035 tip_timer = Qnil;
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10036 staticpro (&tip_timer);
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10037 tip_frame = Qnil;
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10038 staticpro (&tip_frame);
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10039
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10040 #if 0 /* MAC_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10041 defsubr (&Sx_file_dialog);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10042 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10043 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10044
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10045
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10046 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10047 init_xfns ()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10048 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10049 image_types = NULL;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10050 Vimage_types = Qnil;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10051
36417
350e6092a4c4 * src/macfns.c: Rename everything containing *busy_cursor* and
Andrew Choi <akochoi@shaw.ca>
parents: 35660
diff changeset
10052 #if 0 /* TODO : Image support for W32 */
32752
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10053 define_image_type (&xbm_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10054 define_image_type (&gs_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10055 define_image_type (&pbm_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10056
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10057 #if HAVE_XPM
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10058 define_image_type (&xpm_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10059 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10060
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10061 #if HAVE_JPEG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10062 define_image_type (&jpeg_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10063 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10064
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10065 #if HAVE_TIFF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10066 define_image_type (&tiff_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10067 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10068
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10069 #if HAVE_GIF
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10070 define_image_type (&gif_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10071 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10072
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10073 #if HAVE_PNG
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10074 define_image_type (&png_type);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10075 #endif
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10076 #endif /* NTEMACS_TODO */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10077 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10078
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10079 #undef abort
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10080
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10081 #if 0
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10082 void
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10083 w32_abort()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10084 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10085 int button;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10086 button = MessageBox (NULL,
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10087 "A fatal error has occurred!\n\n"
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10088 "Select Abort to exit, Retry to debug, Ignore to continue",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10089 "Emacs Abort Dialog",
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10090 MB_ICONEXCLAMATION | MB_TASKMODAL
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10091 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE);
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10092 switch (button)
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10093 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10094 case IDRETRY:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10095 DebugBreak ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10096 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10097 case IDIGNORE:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10098 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10099 case IDABORT:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10100 default:
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10101 abort ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10102 break;
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10103 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10104 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10105
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10106 /* For convenience when debugging. */
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10107 int
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10108 w32_last_error()
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10109 {
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10110 return GetLastError ();
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10111 }
923b8d6d8277 Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
diff changeset
10112 #endif