Mercurial > emacs
annotate src/w32fns.c @ 21660:9e5b579ba4f9
(make-coding-system): If TYPE is 4, FLAGS
can be a cons of CCL-PROGRAM symbols.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 20 Apr 1998 02:11:52 +0000 |
parents | d191a8737145 |
children | 711a61942023 |
rev | line source |
---|---|
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
1 /* Graphical user interface functions for the Microsoft W32 API. |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
2 Copyright (C) 1989, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. |
13434 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
13434 | 20 |
21 /* Added by Kevin Gallo */ | |
22 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
23 #include <config.h> |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
24 |
13434 | 25 #include <signal.h> |
26 #include <stdio.h> | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
27 #include <limits.h> |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
28 #include <errno.h> |
13434 | 29 |
30 #include "lisp.h" | |
31 #include "w32term.h" | |
32 #include "frame.h" | |
33 #include "window.h" | |
34 #include "buffer.h" | |
35 #include "dispextern.h" | |
36 #include "keyboard.h" | |
37 #include "blockinput.h" | |
38 #include "paths.h" | |
16593
4ed80eda6fac
Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
39 #include "w32heap.h" |
13434 | 40 #include "termhooks.h" |
41 | |
42 #include <commdlg.h> | |
43 | |
44 extern void abort (); | |
45 extern void free_frame_menubar (); | |
46 extern struct scroll_bar *x_window_to_scroll_bar (); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
47 extern int quit_char; |
13434 | 48 |
49 /* The colormap for converting color names to RGB values */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
50 Lisp_Object Vw32_color_map; |
13434 | 51 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
52 /* Non nil if alt key presses are passed on to Windows. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
53 Lisp_Object Vw32_pass_alt_to_system; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
54 |
15459
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
55 /* Non nil if alt key is translated to meta_modifier, nil if it is translated |
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
56 to alt_modifier. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
57 Lisp_Object Vw32_alt_is_meta; |
15459
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
58 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
59 /* Non nil if left window, right window, and application key events |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
60 are passed on to Windows. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
61 Lisp_Object Vw32_pass_optional_keys_to_system; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
62 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
63 /* Switch to control whether we inhibit requests for italicised fonts (which |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
64 are synthesized, look ugly, and are trashed by cursor movement under NT). */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
65 Lisp_Object Vw32_enable_italics; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
66 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
67 /* Enable palette management. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
68 Lisp_Object Vw32_enable_palette; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
69 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
70 /* Control how close left/right button down events must be to |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
71 be converted to a middle button down event. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
72 Lisp_Object Vw32_mouse_button_tolerance; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
73 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
74 /* Minimum interval between mouse movement (and scroll bar drag) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
75 events that are passed on to the event loop. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
76 Lisp_Object Vw32_mouse_move_interval; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
77 |
13434 | 78 /* The name we're using in resource queries. */ |
79 Lisp_Object Vx_resource_name; | |
80 | |
81 /* Non nil if no window manager is in use. */ | |
82 Lisp_Object Vx_no_window_manager; | |
83 | |
84 /* The background and shape of the mouse pointer, and shape when not | |
85 over text or in the modeline. */ | |
86 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; | |
87 /* The shape when over mouse-sensitive text. */ | |
88 Lisp_Object Vx_sensitive_text_pointer_shape; | |
89 | |
90 /* Color of chars displayed in cursor box. */ | |
91 Lisp_Object Vx_cursor_fore_pixel; | |
92 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
93 /* Nonzero if using Windows. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
94 static int w32_in_use; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
95 |
13434 | 96 /* Search path for bitmap files. */ |
97 Lisp_Object Vx_bitmap_file_path; | |
98 | |
99 /* Evaluate this expression to rebuild the section of syms_of_w32fns | |
100 that initializes and staticpros the symbols declared below. Note | |
101 that Emacs 18 has a bug that keeps C-x C-e from being able to | |
102 evaluate this expression. | |
103 | |
104 (progn | |
105 ;; Accumulate a list of the symbols we want to initialize from the | |
106 ;; declarations at the top of the file. | |
107 (goto-char (point-min)) | |
108 (search-forward "/\*&&& symbols declared here &&&*\/\n") | |
109 (let (symbol-list) | |
110 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)") | |
111 (setq symbol-list | |
112 (cons (buffer-substring (match-beginning 1) (match-end 1)) | |
113 symbol-list)) | |
114 (forward-line 1)) | |
115 (setq symbol-list (nreverse symbol-list)) | |
116 ;; Delete the section of syms_of_... where we initialize the symbols. | |
117 (search-forward "\n /\*&&& init symbols here &&&*\/\n") | |
118 (let ((start (point))) | |
119 (while (looking-at "^ Q") | |
120 (forward-line 2)) | |
121 (kill-region start (point))) | |
122 ;; Write a new symbol initialization section. | |
123 (while symbol-list | |
124 (insert (format " %s = intern (\"" (car symbol-list))) | |
125 (let ((start (point))) | |
126 (insert (substring (car symbol-list) 1)) | |
127 (subst-char-in-region start (point) ?_ ?-)) | |
128 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list))) | |
129 (setq symbol-list (cdr symbol-list))))) | |
130 | |
131 */ | |
132 | |
133 /*&&& symbols declared here &&&*/ | |
134 Lisp_Object Qauto_raise; | |
135 Lisp_Object Qauto_lower; | |
136 Lisp_Object Qbackground_color; | |
137 Lisp_Object Qbar; | |
138 Lisp_Object Qborder_color; | |
139 Lisp_Object Qborder_width; | |
140 Lisp_Object Qbox; | |
141 Lisp_Object Qcursor_color; | |
142 Lisp_Object Qcursor_type; | |
143 Lisp_Object Qforeground_color; | |
144 Lisp_Object Qgeometry; | |
145 Lisp_Object Qicon_left; | |
146 Lisp_Object Qicon_top; | |
147 Lisp_Object Qicon_type; | |
148 Lisp_Object Qicon_name; | |
149 Lisp_Object Qinternal_border_width; | |
150 Lisp_Object Qleft; | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
151 Lisp_Object Qright; |
13434 | 152 Lisp_Object Qmouse_color; |
153 Lisp_Object Qnone; | |
154 Lisp_Object Qparent_id; | |
155 Lisp_Object Qscroll_bar_width; | |
156 Lisp_Object Qsuppress_icon; | |
157 Lisp_Object Qtop; | |
158 Lisp_Object Qundefined_color; | |
159 Lisp_Object Qvertical_scroll_bars; | |
160 Lisp_Object Qvisibility; | |
161 Lisp_Object Qwindow_id; | |
162 Lisp_Object Qx_frame_parameter; | |
163 Lisp_Object Qx_resource_name; | |
164 Lisp_Object Quser_position; | |
165 Lisp_Object Quser_size; | |
166 Lisp_Object Qdisplay; | |
167 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
168 /* State variables for emulating a three button mouse. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
169 #define LMOUSE 1 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
170 #define MMOUSE 2 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
171 #define RMOUSE 4 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
172 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
173 static int button_state = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
174 static W32Msg saved_mouse_button_msg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
175 static unsigned mouse_button_timer; /* non-zero when timer is active */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
176 static W32Msg saved_mouse_move_msg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
177 static unsigned mouse_move_timer; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
178 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
179 #define MOUSE_BUTTON_ID 1 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
180 #define MOUSE_MOVE_ID 2 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
181 |
13434 | 182 /* The below are defined in frame.c. */ |
183 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
184 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; |
13434 | 185 |
186 extern Lisp_Object Vwindow_system_version; | |
187 | |
188 extern Lisp_Object last_mouse_scroll_bar; | |
189 extern int last_mouse_scroll_bar_pos; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
190 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
191 /* From w32term.c. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
192 extern Lisp_Object Vw32_num_mouse_buttons; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
193 |
13434 | 194 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
195 /* Error if we are not connected to MS-Windows. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
196 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
197 check_w32 () |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
198 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
199 if (! w32_in_use) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
200 error ("MS-Windows not in use or not initialized"); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
201 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
202 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
203 /* Nonzero if we can use mouse menus. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
204 You should not call this unless HAVE_MENUS is defined. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
205 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
206 int |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
207 have_menus_p () |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
208 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
209 return w32_in_use; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
210 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
211 |
13434 | 212 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
213 and checking validity for W32. */ |
13434 | 214 |
215 FRAME_PTR | |
216 check_x_frame (frame) | |
217 Lisp_Object frame; | |
218 { | |
219 FRAME_PTR f; | |
220 | |
221 if (NILP (frame)) | |
222 f = selected_frame; | |
223 else | |
224 { | |
225 CHECK_LIVE_FRAME (frame, 0); | |
226 f = XFRAME (frame); | |
227 } | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
228 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
229 error ("non-w32 frame used"); |
13434 | 230 return f; |
231 } | |
232 | |
233 /* Let the user specify an display with a frame. | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
234 nil stands for the selected frame--or, if that is not a w32 frame, |
13434 | 235 the first display on the list. */ |
236 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
237 static struct w32_display_info * |
13434 | 238 check_x_display_info (frame) |
239 Lisp_Object frame; | |
240 { | |
241 if (NILP (frame)) | |
242 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
243 if (FRAME_W32_P (selected_frame)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
244 return FRAME_W32_DISPLAY_INFO (selected_frame); |
13434 | 245 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
246 return &one_w32_display_info; |
13434 | 247 } |
248 else if (STRINGP (frame)) | |
249 return x_display_info_for_name (frame); | |
250 else | |
251 { | |
252 FRAME_PTR f; | |
253 | |
254 CHECK_LIVE_FRAME (frame, 0); | |
255 f = XFRAME (frame); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
256 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
257 error ("non-w32 frame used"); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
258 return FRAME_W32_DISPLAY_INFO (f); |
13434 | 259 } |
260 } | |
261 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
262 /* Return the Emacs frame-object corresponding to an w32 window. |
13434 | 263 It could be the frame's main window or an icon window. */ |
264 | |
265 /* This function can be called during GC, so use GC_xxx type test macros. */ | |
266 | |
267 struct frame * | |
268 x_window_to_frame (dpyinfo, wdesc) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
269 struct w32_display_info *dpyinfo; |
13434 | 270 HWND wdesc; |
271 { | |
272 Lisp_Object tail, frame; | |
273 struct frame *f; | |
274 | |
275 for (tail = Vframe_list; GC_CONSP (tail); tail = XCONS (tail)->cdr) | |
276 { | |
277 frame = XCONS (tail)->car; | |
278 if (!GC_FRAMEP (frame)) | |
279 continue; | |
280 f = XFRAME (frame); | |
281 if (f->output_data.nothing == 1 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
282 || FRAME_W32_DISPLAY_INFO (f) != dpyinfo) |
13434 | 283 continue; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
284 if (FRAME_W32_WINDOW (f) == wdesc) |
13434 | 285 return f; |
286 } | |
287 return 0; | |
288 } | |
289 | |
290 | |
291 | |
292 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap | |
293 id, which is just an int that this section returns. Bitmaps are | |
294 reference counted so they can be shared among frames. | |
295 | |
296 Bitmap indices are guaranteed to be > 0, so a negative number can | |
297 be used to indicate no bitmap. | |
298 | |
299 If you use x_create_bitmap_from_data, then you must keep track of | |
300 the bitmaps yourself. That is, creating a bitmap from the same | |
301 data more than once will not be caught. */ | |
302 | |
303 | |
304 /* Functions to access the contents of a bitmap, given an id. */ | |
305 | |
306 int | |
307 x_bitmap_height (f, id) | |
308 FRAME_PTR f; | |
309 int id; | |
310 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
311 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].height; |
13434 | 312 } |
313 | |
314 int | |
315 x_bitmap_width (f, id) | |
316 FRAME_PTR f; | |
317 int id; | |
318 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
319 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].width; |
13434 | 320 } |
321 | |
322 int | |
323 x_bitmap_pixmap (f, id) | |
324 FRAME_PTR f; | |
325 int id; | |
326 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
327 return (int) FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; |
13434 | 328 } |
329 | |
330 | |
331 /* Allocate a new bitmap record. Returns index of new record. */ | |
332 | |
333 static int | |
334 x_allocate_bitmap_record (f) | |
335 FRAME_PTR f; | |
336 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
337 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 338 int i; |
339 | |
340 if (dpyinfo->bitmaps == NULL) | |
341 { | |
342 dpyinfo->bitmaps_size = 10; | |
343 dpyinfo->bitmaps | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
344 = (struct w32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record)); |
13434 | 345 dpyinfo->bitmaps_last = 1; |
346 return 1; | |
347 } | |
348 | |
349 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size) | |
350 return ++dpyinfo->bitmaps_last; | |
351 | |
352 for (i = 0; i < dpyinfo->bitmaps_size; ++i) | |
353 if (dpyinfo->bitmaps[i].refcount == 0) | |
354 return i + 1; | |
355 | |
356 dpyinfo->bitmaps_size *= 2; | |
357 dpyinfo->bitmaps | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
358 = (struct w32_bitmap_record *) xrealloc (dpyinfo->bitmaps, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
359 dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record)); |
13434 | 360 return ++dpyinfo->bitmaps_last; |
361 } | |
362 | |
363 /* Add one reference to the reference count of the bitmap with id ID. */ | |
364 | |
365 void | |
366 x_reference_bitmap (f, id) | |
367 FRAME_PTR f; | |
368 int id; | |
369 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
370 ++FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; |
13434 | 371 } |
372 | |
373 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ | |
374 | |
375 int | |
376 x_create_bitmap_from_data (f, bits, width, height) | |
377 struct frame *f; | |
378 char *bits; | |
379 unsigned int width, height; | |
380 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
381 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 382 Pixmap bitmap; |
383 int id; | |
384 | |
385 bitmap = CreateBitmap (width, height, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
386 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_planes, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
387 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits, |
13434 | 388 bits); |
389 | |
390 if (! bitmap) | |
391 return -1; | |
392 | |
393 id = x_allocate_bitmap_record (f); | |
394 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
395 dpyinfo->bitmaps[id - 1].file = NULL; | |
396 dpyinfo->bitmaps[id - 1].hinst = NULL; | |
397 dpyinfo->bitmaps[id - 1].refcount = 1; | |
398 dpyinfo->bitmaps[id - 1].depth = 1; | |
399 dpyinfo->bitmaps[id - 1].height = height; | |
400 dpyinfo->bitmaps[id - 1].width = width; | |
401 | |
402 return id; | |
403 } | |
404 | |
405 /* Create bitmap from file FILE for frame F. */ | |
406 | |
407 int | |
408 x_create_bitmap_from_file (f, file) | |
409 struct frame *f; | |
410 Lisp_Object file; | |
411 { | |
412 return -1; | |
413 #if 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
414 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 415 unsigned int width, height; |
416 Pixmap bitmap; | |
417 int xhot, yhot, result, id; | |
418 Lisp_Object found; | |
419 int fd; | |
420 char *filename; | |
421 HINSTANCE hinst; | |
422 | |
423 /* Look for an existing bitmap with the same name. */ | |
424 for (id = 0; id < dpyinfo->bitmaps_last; ++id) | |
425 { | |
426 if (dpyinfo->bitmaps[id].refcount | |
427 && dpyinfo->bitmaps[id].file | |
428 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) | |
429 { | |
430 ++dpyinfo->bitmaps[id].refcount; | |
431 return id + 1; | |
432 } | |
433 } | |
434 | |
435 /* Search bitmap-file-path for the file, if appropriate. */ | |
436 fd = openp (Vx_bitmap_file_path, file, "", &found, 0); | |
437 if (fd < 0) | |
438 return -1; | |
439 close (fd); | |
440 | |
441 filename = (char *) XSTRING (found)->data; | |
442 | |
443 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE); | |
444 | |
445 if (hinst == NULL) | |
446 return -1; | |
447 | |
448 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
449 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
13434 | 450 filename, &width, &height, &bitmap, &xhot, &yhot); |
451 if (result != BitmapSuccess) | |
452 return -1; | |
453 | |
454 id = x_allocate_bitmap_record (f); | |
455 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
456 dpyinfo->bitmaps[id - 1].refcount = 1; | |
457 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1); | |
458 dpyinfo->bitmaps[id - 1].depth = 1; | |
459 dpyinfo->bitmaps[id - 1].height = height; | |
460 dpyinfo->bitmaps[id - 1].width = width; | |
461 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); | |
462 | |
463 return id; | |
464 #endif | |
465 } | |
466 | |
467 /* Remove reference to bitmap with id number ID. */ | |
468 | |
469 int | |
470 x_destroy_bitmap (f, id) | |
471 FRAME_PTR f; | |
472 int id; | |
473 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
474 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 475 |
476 if (id > 0) | |
477 { | |
478 --dpyinfo->bitmaps[id - 1].refcount; | |
479 if (dpyinfo->bitmaps[id - 1].refcount == 0) | |
480 { | |
481 BLOCK_INPUT; | |
482 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap); | |
483 if (dpyinfo->bitmaps[id - 1].file) | |
484 { | |
485 free (dpyinfo->bitmaps[id - 1].file); | |
486 dpyinfo->bitmaps[id - 1].file = NULL; | |
487 } | |
488 UNBLOCK_INPUT; | |
489 } | |
490 } | |
491 } | |
492 | |
493 /* Free all the bitmaps for the display specified by DPYINFO. */ | |
494 | |
495 static void | |
496 x_destroy_all_bitmaps (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
497 struct w32_display_info *dpyinfo; |
13434 | 498 { |
499 int i; | |
500 for (i = 0; i < dpyinfo->bitmaps_last; i++) | |
501 if (dpyinfo->bitmaps[i].refcount > 0) | |
502 { | |
503 DeleteObject (dpyinfo->bitmaps[i].pixmap); | |
504 if (dpyinfo->bitmaps[i].file) | |
505 free (dpyinfo->bitmaps[i].file); | |
506 } | |
507 dpyinfo->bitmaps_last = 0; | |
508 } | |
509 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
510 /* Connect the frame-parameter names for W32 frames |
13434 | 511 to the ways of passing the parameter values to the window system. |
512 | |
513 The name of a parameter, as a Lisp symbol, | |
514 has an `x-frame-parameter' property which is an integer in Lisp | |
515 but can be interpreted as an `enum x_frame_parm' in C. */ | |
516 | |
517 enum x_frame_parm | |
518 { | |
519 X_PARM_FOREGROUND_COLOR, | |
520 X_PARM_BACKGROUND_COLOR, | |
521 X_PARM_MOUSE_COLOR, | |
522 X_PARM_CURSOR_COLOR, | |
523 X_PARM_BORDER_COLOR, | |
524 X_PARM_ICON_TYPE, | |
525 X_PARM_FONT, | |
526 X_PARM_BORDER_WIDTH, | |
527 X_PARM_INTERNAL_BORDER_WIDTH, | |
528 X_PARM_NAME, | |
529 X_PARM_AUTORAISE, | |
530 X_PARM_AUTOLOWER, | |
531 X_PARM_VERT_SCROLL_BAR, | |
532 X_PARM_VISIBILITY, | |
533 X_PARM_MENU_BAR_LINES | |
534 }; | |
535 | |
536 | |
537 struct x_frame_parm_table | |
538 { | |
539 char *name; | |
540 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ ); | |
541 }; | |
542 | |
543 void x_set_foreground_color (); | |
544 void x_set_background_color (); | |
545 void x_set_mouse_color (); | |
546 void x_set_cursor_color (); | |
547 void x_set_border_color (); | |
548 void x_set_cursor_type (); | |
549 void x_set_icon_type (); | |
550 void x_set_icon_name (); | |
551 void x_set_font (); | |
552 void x_set_border_width (); | |
553 void x_set_internal_border_width (); | |
554 void x_explicitly_set_name (); | |
555 void x_set_autoraise (); | |
556 void x_set_autolower (); | |
557 void x_set_vertical_scroll_bars (); | |
558 void x_set_visibility (); | |
559 void x_set_menu_bar_lines (); | |
560 void x_set_scroll_bar_width (); | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
561 void x_set_title (); |
13434 | 562 void x_set_unsplittable (); |
563 | |
564 static struct x_frame_parm_table x_frame_parms[] = | |
565 { | |
566 "auto-raise", x_set_autoraise, | |
567 "auto-lower", x_set_autolower, | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
568 "background-color", x_set_background_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
569 "border-color", x_set_border_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
570 "border-width", x_set_border_width, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
571 "cursor-color", x_set_cursor_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
572 "cursor-type", x_set_cursor_type, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
573 "font", x_set_font, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
574 "foreground-color", x_set_foreground_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
575 "icon-name", x_set_icon_name, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
576 "icon-type", x_set_icon_type, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
577 "internal-border-width", x_set_internal_border_width, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
578 "menu-bar-lines", x_set_menu_bar_lines, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
579 "mouse-color", x_set_mouse_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
580 "name", x_explicitly_set_name, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
581 "scroll-bar-width", x_set_scroll_bar_width, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
582 "title", x_set_title, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
583 "unsplittable", x_set_unsplittable, |
13434 | 584 "vertical-scroll-bars", x_set_vertical_scroll_bars, |
585 "visibility", x_set_visibility, | |
586 }; | |
587 | |
588 /* Attach the `x-frame-parameter' properties to | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
589 the Lisp symbol names of parameters relevant to W32. */ |
13434 | 590 |
591 init_x_parm_symbols () | |
592 { | |
593 int i; | |
594 | |
595 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++) | |
596 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, | |
597 make_number (i)); | |
598 } | |
599 | |
600 /* Change the parameters of FRAME as specified by ALIST. | |
601 If a parameter is not specially recognized, do nothing; | |
602 otherwise call the `x_set_...' function for that parameter. */ | |
603 | |
604 void | |
605 x_set_frame_parameters (f, alist) | |
606 FRAME_PTR f; | |
607 Lisp_Object alist; | |
608 { | |
609 Lisp_Object tail; | |
610 | |
611 /* If both of these parameters are present, it's more efficient to | |
612 set them both at once. So we wait until we've looked at the | |
613 entire list before we set them. */ | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
614 int width, height; |
13434 | 615 |
616 /* Same here. */ | |
617 Lisp_Object left, top; | |
618 | |
619 /* Same with these. */ | |
620 Lisp_Object icon_left, icon_top; | |
621 | |
622 /* Record in these vectors all the parms specified. */ | |
623 Lisp_Object *parms; | |
624 Lisp_Object *values; | |
625 int i; | |
626 int left_no_change = 0, top_no_change = 0; | |
627 int icon_left_no_change = 0, icon_top_no_change = 0; | |
628 | |
629 i = 0; | |
630 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
631 i++; | |
632 | |
633 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
634 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
635 | |
636 /* Extract parm names and values into those vectors. */ | |
637 | |
638 i = 0; | |
639 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
640 { | |
641 Lisp_Object elt, prop, val; | |
642 | |
643 elt = Fcar (tail); | |
644 parms[i] = Fcar (elt); | |
645 values[i] = Fcdr (elt); | |
646 i++; | |
647 } | |
648 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
649 top = left = Qunbound; |
13434 | 650 icon_left = icon_top = Qunbound; |
651 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
652 /* Provide default values for HEIGHT and WIDTH. */ |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
653 width = FRAME_WIDTH (f); |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
654 height = FRAME_HEIGHT (f); |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
655 |
13434 | 656 /* Now process them in reverse of specified order. */ |
657 for (i--; i >= 0; i--) | |
658 { | |
659 Lisp_Object prop, val; | |
660 | |
661 prop = parms[i]; | |
662 val = values[i]; | |
663 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
664 if (EQ (prop, Qwidth) && NUMBERP (val)) |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
665 width = XFASTINT (val); |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
666 else if (EQ (prop, Qheight) && NUMBERP (val)) |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
667 height = XFASTINT (val); |
13434 | 668 else if (EQ (prop, Qtop)) |
669 top = val; | |
670 else if (EQ (prop, Qleft)) | |
671 left = val; | |
672 else if (EQ (prop, Qicon_top)) | |
673 icon_top = val; | |
674 else if (EQ (prop, Qicon_left)) | |
675 icon_left = val; | |
676 else | |
677 { | |
678 register Lisp_Object param_index, old_value; | |
679 | |
680 param_index = Fget (prop, Qx_frame_parameter); | |
681 old_value = get_frame_param (f, prop); | |
682 store_frame_param (f, prop, val); | |
683 if (NATNUMP (param_index) | |
684 && (XFASTINT (param_index) | |
685 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) | |
14353 | 686 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); |
13434 | 687 } |
688 } | |
689 | |
690 /* Don't die if just one of these was set. */ | |
691 if (EQ (left, Qunbound)) | |
692 { | |
693 left_no_change = 1; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
694 if (f->output_data.w32->left_pos < 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
695 left = Fcons (Qplus, Fcons (make_number (f->output_data.w32->left_pos), Qnil)); |
13434 | 696 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
697 XSETINT (left, f->output_data.w32->left_pos); |
13434 | 698 } |
699 if (EQ (top, Qunbound)) | |
700 { | |
701 top_no_change = 1; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
702 if (f->output_data.w32->top_pos < 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
703 top = Fcons (Qplus, Fcons (make_number (f->output_data.w32->top_pos), Qnil)); |
13434 | 704 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
705 XSETINT (top, f->output_data.w32->top_pos); |
13434 | 706 } |
707 | |
708 /* If one of the icon positions was not set, preserve or default it. */ | |
709 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left)) | |
710 { | |
711 icon_left_no_change = 1; | |
712 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); | |
713 if (NILP (icon_left)) | |
714 XSETINT (icon_left, 0); | |
715 } | |
716 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top)) | |
717 { | |
718 icon_top_no_change = 1; | |
719 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); | |
720 if (NILP (icon_top)) | |
721 XSETINT (icon_top, 0); | |
722 } | |
723 | |
724 /* Don't set these parameters unless they've been explicitly | |
725 specified. The window might be mapped or resized while we're in | |
726 this function, and we don't want to override that unless the lisp | |
727 code has asked for it. | |
728 | |
729 Don't set these parameters unless they actually differ from the | |
730 window's current parameters; the window may not actually exist | |
731 yet. */ | |
732 { | |
733 Lisp_Object frame; | |
734 | |
735 check_frame_size (f, &height, &width); | |
736 | |
737 XSETFRAME (frame, f); | |
738 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
739 if (XINT (width) != FRAME_WIDTH (f) |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
740 || XINT (height) != FRAME_HEIGHT (f)) |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
741 Fset_frame_size (frame, make_number (width), make_number (height)); |
13434 | 742 |
743 if ((!NILP (left) || !NILP (top)) | |
744 && ! (left_no_change && top_no_change) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
745 && ! (NUMBERP (left) && XINT (left) == f->output_data.w32->left_pos |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
746 && NUMBERP (top) && XINT (top) == f->output_data.w32->top_pos)) |
13434 | 747 { |
748 int leftpos = 0; | |
749 int toppos = 0; | |
750 | |
751 /* Record the signs. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
752 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); |
13434 | 753 if (EQ (left, Qminus)) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
754 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 755 else if (INTEGERP (left)) |
756 { | |
757 leftpos = XINT (left); | |
758 if (leftpos < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
759 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 760 } |
761 else if (CONSP (left) && EQ (XCONS (left)->car, Qminus) | |
762 && CONSP (XCONS (left)->cdr) | |
763 && INTEGERP (XCONS (XCONS (left)->cdr)->car)) | |
764 { | |
765 leftpos = - XINT (XCONS (XCONS (left)->cdr)->car); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
766 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 767 } |
768 else if (CONSP (left) && EQ (XCONS (left)->car, Qplus) | |
769 && CONSP (XCONS (left)->cdr) | |
770 && INTEGERP (XCONS (XCONS (left)->cdr)->car)) | |
771 { | |
772 leftpos = XINT (XCONS (XCONS (left)->cdr)->car); | |
773 } | |
774 | |
775 if (EQ (top, Qminus)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
776 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 777 else if (INTEGERP (top)) |
778 { | |
779 toppos = XINT (top); | |
780 if (toppos < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
781 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 782 } |
783 else if (CONSP (top) && EQ (XCONS (top)->car, Qminus) | |
784 && CONSP (XCONS (top)->cdr) | |
785 && INTEGERP (XCONS (XCONS (top)->cdr)->car)) | |
786 { | |
787 toppos = - XINT (XCONS (XCONS (top)->cdr)->car); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
788 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 789 } |
790 else if (CONSP (top) && EQ (XCONS (top)->car, Qplus) | |
791 && CONSP (XCONS (top)->cdr) | |
792 && INTEGERP (XCONS (XCONS (top)->cdr)->car)) | |
793 { | |
794 toppos = XINT (XCONS (XCONS (top)->cdr)->car); | |
795 } | |
796 | |
797 | |
798 /* Store the numeric value of the position. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
799 f->output_data.w32->top_pos = toppos; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
800 f->output_data.w32->left_pos = leftpos; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
801 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
802 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 803 |
804 /* Actually set that position, and convert to absolute. */ | |
805 x_set_offset (f, leftpos, toppos, -1); | |
806 } | |
807 | |
808 if ((!NILP (icon_left) || !NILP (icon_top)) | |
809 && ! (icon_left_no_change && icon_top_no_change)) | |
810 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); | |
811 } | |
812 } | |
813 | |
814 /* Store the screen positions of frame F into XPTR and YPTR. | |
815 These are the positions of the containing window manager window, | |
816 not Emacs's own window. */ | |
817 | |
818 void | |
819 x_real_positions (f, xptr, yptr) | |
820 FRAME_PTR f; | |
821 int *xptr, *yptr; | |
822 { | |
823 POINT pt; | |
14353 | 824 |
825 { | |
826 RECT rect; | |
13434 | 827 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
828 GetClientRect(FRAME_W32_WINDOW(f), &rect); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
829 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f)); |
13434 | 830 |
14353 | 831 pt.x = rect.left; |
832 pt.y = rect.top; | |
833 } | |
834 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
835 ClientToScreen (FRAME_W32_WINDOW(f), &pt); |
13434 | 836 |
837 *xptr = pt.x; | |
838 *yptr = pt.y; | |
839 } | |
840 | |
841 /* Insert a description of internally-recorded parameters of frame X | |
842 into the parameter alist *ALISTPTR that is to be given to the user. | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
843 Only parameters that are specific to W32 |
13434 | 844 and whose values are not correctly recorded in the frame's |
845 param_alist need to be considered here. */ | |
846 | |
847 x_report_frame_params (f, alistptr) | |
848 struct frame *f; | |
849 Lisp_Object *alistptr; | |
850 { | |
851 char buf[16]; | |
852 Lisp_Object tem; | |
853 | |
854 /* Represent negative positions (off the top or left screen edge) | |
855 in a way that Fmodify_frame_parameters will understand correctly. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
856 XSETINT (tem, f->output_data.w32->left_pos); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
857 if (f->output_data.w32->left_pos >= 0) |
13434 | 858 store_in_alist (alistptr, Qleft, tem); |
859 else | |
860 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil))); | |
861 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
862 XSETINT (tem, f->output_data.w32->top_pos); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
863 if (f->output_data.w32->top_pos >= 0) |
13434 | 864 store_in_alist (alistptr, Qtop, tem); |
865 else | |
866 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil))); | |
867 | |
868 store_in_alist (alistptr, Qborder_width, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
869 make_number (f->output_data.w32->border_width)); |
13434 | 870 store_in_alist (alistptr, Qinternal_border_width, |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
871 make_number (f->output_data.w32->internal_border_width)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
872 sprintf (buf, "%ld", (long) FRAME_W32_WINDOW (f)); |
13434 | 873 store_in_alist (alistptr, Qwindow_id, |
874 build_string (buf)); | |
875 store_in_alist (alistptr, Qicon_name, f->icon_name); | |
876 FRAME_SAMPLE_VISIBILITY (f); | |
877 store_in_alist (alistptr, Qvisibility, | |
878 (FRAME_VISIBLE_P (f) ? Qt | |
879 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); | |
880 store_in_alist (alistptr, Qdisplay, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
881 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->car); |
13434 | 882 } |
883 | |
884 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
885 DEFUN ("w32-define-rgb-color", Fw32_define_rgb_color, Sw32_define_rgb_color, 4, 4, 0, |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
886 "Convert RGB numbers to a windows color reference and associate with NAME (a string).\n\ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
887 This adds or updates a named color to w32-color-map, making it available for use.\n\ |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
888 The original entry's RGB ref is returned, or nil if the entry is new.") |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
889 (red, green, blue, name) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
890 Lisp_Object red, green, blue, name; |
13434 | 891 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
892 Lisp_Object rgb; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
893 Lisp_Object oldrgb = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
894 Lisp_Object entry; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
895 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
896 CHECK_NUMBER (red, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
897 CHECK_NUMBER (green, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
898 CHECK_NUMBER (blue, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
899 CHECK_STRING (name, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
900 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
901 XSET (rgb, Lisp_Int, RGB(XUINT (red), XUINT (green), XUINT (blue))); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
902 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
903 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
904 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
905 /* replace existing entry in w32-color-map or add new entry. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
906 entry = Fassoc (name, Vw32_color_map); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
907 if (NILP (entry)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
908 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
909 entry = Fcons (name, rgb); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
910 Vw32_color_map = Fcons (entry, Vw32_color_map); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
911 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
912 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
913 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
914 oldrgb = Fcdr (entry); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
915 Fsetcdr (entry, rgb); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
916 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
917 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
918 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
919 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
920 return (oldrgb); |
13434 | 921 } |
922 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
923 DEFUN ("w32-load-color-file", Fw32_load_color_file, Sw32_load_color_file, 1, 1, 0, |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
924 "Create an alist of color entries from an external file (ie. rgb.txt).\n\ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
925 Assign this value to w32-color-map to replace the existing color map.\n\ |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
926 \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
927 The file should define one named RGB color per line like so:\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
928 R G B name\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
929 where R,G,B are numbers between 0 and 255 and name is an arbitrary string.") |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
930 (filename) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
931 Lisp_Object filename; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
932 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
933 FILE *fp; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
934 Lisp_Object cmap = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
935 Lisp_Object abspath; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
936 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
937 CHECK_STRING (filename, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
938 abspath = Fexpand_file_name (filename, Qnil); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
939 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
940 fp = fopen (XSTRING (filename)->data, "rt"); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
941 if (fp) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
942 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
943 char buf[512]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
944 int red, green, blue; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
945 int num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
946 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
947 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
948 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
949 while (fgets (buf, sizeof (buf), fp) != NULL) { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
950 if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
951 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
952 char *name = buf + num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
953 num = strlen (name) - 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
954 if (name[num] == '\n') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
955 name[num] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
956 cmap = Fcons (Fcons (build_string (name), |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
957 make_number (RGB (red, green, blue))), |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
958 cmap); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
959 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
960 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
961 fclose (fp); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
962 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
963 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
964 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
965 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
966 return cmap; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
967 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
968 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
969 /* The default colors for the w32 color map */ |
13434 | 970 typedef struct colormap_t |
971 { | |
972 char *name; | |
973 COLORREF colorref; | |
974 } colormap_t; | |
975 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
976 colormap_t w32_color_map[] = |
13434 | 977 { |
14983
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
978 {"snow" , PALETTERGB (255,250,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
979 {"ghost white" , PALETTERGB (248,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
980 {"GhostWhite" , PALETTERGB (248,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
981 {"white smoke" , PALETTERGB (245,245,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
982 {"WhiteSmoke" , PALETTERGB (245,245,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
983 {"gainsboro" , PALETTERGB (220,220,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
984 {"floral white" , PALETTERGB (255,250,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
985 {"FloralWhite" , PALETTERGB (255,250,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
986 {"old lace" , PALETTERGB (253,245,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
987 {"OldLace" , PALETTERGB (253,245,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
988 {"linen" , PALETTERGB (250,240,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
989 {"antique white" , PALETTERGB (250,235,215)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
990 {"AntiqueWhite" , PALETTERGB (250,235,215)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
991 {"papaya whip" , PALETTERGB (255,239,213)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
992 {"PapayaWhip" , PALETTERGB (255,239,213)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
993 {"blanched almond" , PALETTERGB (255,235,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
994 {"BlanchedAlmond" , PALETTERGB (255,235,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
995 {"bisque" , PALETTERGB (255,228,196)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
996 {"peach puff" , PALETTERGB (255,218,185)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
997 {"PeachPuff" , PALETTERGB (255,218,185)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
998 {"navajo white" , PALETTERGB (255,222,173)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
999 {"NavajoWhite" , PALETTERGB (255,222,173)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1000 {"moccasin" , PALETTERGB (255,228,181)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1001 {"cornsilk" , PALETTERGB (255,248,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1002 {"ivory" , PALETTERGB (255,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1003 {"lemon chiffon" , PALETTERGB (255,250,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1004 {"LemonChiffon" , PALETTERGB (255,250,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1005 {"seashell" , PALETTERGB (255,245,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1006 {"honeydew" , PALETTERGB (240,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1007 {"mint cream" , PALETTERGB (245,255,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1008 {"MintCream" , PALETTERGB (245,255,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1009 {"azure" , PALETTERGB (240,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1010 {"alice blue" , PALETTERGB (240,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1011 {"AliceBlue" , PALETTERGB (240,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1012 {"lavender" , PALETTERGB (230,230,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1013 {"lavender blush" , PALETTERGB (255,240,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1014 {"LavenderBlush" , PALETTERGB (255,240,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1015 {"misty rose" , PALETTERGB (255,228,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1016 {"MistyRose" , PALETTERGB (255,228,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1017 {"white" , PALETTERGB (255,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1018 {"black" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1019 {"dark slate gray" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1020 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1021 {"dark slate grey" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1022 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1023 {"dim gray" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1024 {"DimGray" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1025 {"dim grey" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1026 {"DimGrey" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1027 {"slate gray" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1028 {"SlateGray" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1029 {"slate grey" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1030 {"SlateGrey" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1031 {"light slate gray" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1032 {"LightSlateGray" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1033 {"light slate grey" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1034 {"LightSlateGrey" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1035 {"gray" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1036 {"grey" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1037 {"light grey" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1038 {"LightGrey" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1039 {"light gray" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1040 {"LightGray" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1041 {"midnight blue" , PALETTERGB ( 25, 25,112)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1042 {"MidnightBlue" , PALETTERGB ( 25, 25,112)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1043 {"navy" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1044 {"navy blue" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1045 {"NavyBlue" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1046 {"cornflower blue" , PALETTERGB (100,149,237)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1047 {"CornflowerBlue" , PALETTERGB (100,149,237)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1048 {"dark slate blue" , PALETTERGB ( 72, 61,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1049 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1050 {"slate blue" , PALETTERGB (106, 90,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1051 {"SlateBlue" , PALETTERGB (106, 90,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1052 {"medium slate blue" , PALETTERGB (123,104,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1053 {"MediumSlateBlue" , PALETTERGB (123,104,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1054 {"light slate blue" , PALETTERGB (132,112,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1055 {"LightSlateBlue" , PALETTERGB (132,112,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1056 {"medium blue" , PALETTERGB ( 0, 0,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1057 {"MediumBlue" , PALETTERGB ( 0, 0,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1058 {"royal blue" , PALETTERGB ( 65,105,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1059 {"RoyalBlue" , PALETTERGB ( 65,105,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1060 {"blue" , PALETTERGB ( 0, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1061 {"dodger blue" , PALETTERGB ( 30,144,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1062 {"DodgerBlue" , PALETTERGB ( 30,144,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1063 {"deep sky blue" , PALETTERGB ( 0,191,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1064 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1065 {"sky blue" , PALETTERGB (135,206,235)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1066 {"SkyBlue" , PALETTERGB (135,206,235)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1067 {"light sky blue" , PALETTERGB (135,206,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1068 {"LightSkyBlue" , PALETTERGB (135,206,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1069 {"steel blue" , PALETTERGB ( 70,130,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1070 {"SteelBlue" , PALETTERGB ( 70,130,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1071 {"light steel blue" , PALETTERGB (176,196,222)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1072 {"LightSteelBlue" , PALETTERGB (176,196,222)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1073 {"light blue" , PALETTERGB (173,216,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1074 {"LightBlue" , PALETTERGB (173,216,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1075 {"powder blue" , PALETTERGB (176,224,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1076 {"PowderBlue" , PALETTERGB (176,224,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1077 {"pale turquoise" , PALETTERGB (175,238,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1078 {"PaleTurquoise" , PALETTERGB (175,238,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1079 {"dark turquoise" , PALETTERGB ( 0,206,209)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1080 {"DarkTurquoise" , PALETTERGB ( 0,206,209)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1081 {"medium turquoise" , PALETTERGB ( 72,209,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1082 {"MediumTurquoise" , PALETTERGB ( 72,209,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1083 {"turquoise" , PALETTERGB ( 64,224,208)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1084 {"cyan" , PALETTERGB ( 0,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1085 {"light cyan" , PALETTERGB (224,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1086 {"LightCyan" , PALETTERGB (224,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1087 {"cadet blue" , PALETTERGB ( 95,158,160)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1088 {"CadetBlue" , PALETTERGB ( 95,158,160)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1089 {"medium aquamarine" , PALETTERGB (102,205,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1090 {"MediumAquamarine" , PALETTERGB (102,205,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1091 {"aquamarine" , PALETTERGB (127,255,212)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1092 {"dark green" , PALETTERGB ( 0,100, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1093 {"DarkGreen" , PALETTERGB ( 0,100, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1094 {"dark olive green" , PALETTERGB ( 85,107, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1095 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1096 {"dark sea green" , PALETTERGB (143,188,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1097 {"DarkSeaGreen" , PALETTERGB (143,188,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1098 {"sea green" , PALETTERGB ( 46,139, 87)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1099 {"SeaGreen" , PALETTERGB ( 46,139, 87)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1100 {"medium sea green" , PALETTERGB ( 60,179,113)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1101 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1102 {"light sea green" , PALETTERGB ( 32,178,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1103 {"LightSeaGreen" , PALETTERGB ( 32,178,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1104 {"pale green" , PALETTERGB (152,251,152)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1105 {"PaleGreen" , PALETTERGB (152,251,152)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1106 {"spring green" , PALETTERGB ( 0,255,127)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1107 {"SpringGreen" , PALETTERGB ( 0,255,127)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1108 {"lawn green" , PALETTERGB (124,252, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1109 {"LawnGreen" , PALETTERGB (124,252, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1110 {"green" , PALETTERGB ( 0,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1111 {"chartreuse" , PALETTERGB (127,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1112 {"medium spring green" , PALETTERGB ( 0,250,154)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1113 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1114 {"green yellow" , PALETTERGB (173,255, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1115 {"GreenYellow" , PALETTERGB (173,255, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1116 {"lime green" , PALETTERGB ( 50,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1117 {"LimeGreen" , PALETTERGB ( 50,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1118 {"yellow green" , PALETTERGB (154,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1119 {"YellowGreen" , PALETTERGB (154,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1120 {"forest green" , PALETTERGB ( 34,139, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1121 {"ForestGreen" , PALETTERGB ( 34,139, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1122 {"olive drab" , PALETTERGB (107,142, 35)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1123 {"OliveDrab" , PALETTERGB (107,142, 35)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1124 {"dark khaki" , PALETTERGB (189,183,107)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1125 {"DarkKhaki" , PALETTERGB (189,183,107)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1126 {"khaki" , PALETTERGB (240,230,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1127 {"pale goldenrod" , PALETTERGB (238,232,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1128 {"PaleGoldenrod" , PALETTERGB (238,232,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1129 {"light goldenrod yellow" , PALETTERGB (250,250,210)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1130 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1131 {"light yellow" , PALETTERGB (255,255,224)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1132 {"LightYellow" , PALETTERGB (255,255,224)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1133 {"yellow" , PALETTERGB (255,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1134 {"gold" , PALETTERGB (255,215, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1135 {"light goldenrod" , PALETTERGB (238,221,130)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1136 {"LightGoldenrod" , PALETTERGB (238,221,130)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1137 {"goldenrod" , PALETTERGB (218,165, 32)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1138 {"dark goldenrod" , PALETTERGB (184,134, 11)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1139 {"DarkGoldenrod" , PALETTERGB (184,134, 11)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1140 {"rosy brown" , PALETTERGB (188,143,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1141 {"RosyBrown" , PALETTERGB (188,143,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1142 {"indian red" , PALETTERGB (205, 92, 92)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1143 {"IndianRed" , PALETTERGB (205, 92, 92)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1144 {"saddle brown" , PALETTERGB (139, 69, 19)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1145 {"SaddleBrown" , PALETTERGB (139, 69, 19)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1146 {"sienna" , PALETTERGB (160, 82, 45)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1147 {"peru" , PALETTERGB (205,133, 63)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1148 {"burlywood" , PALETTERGB (222,184,135)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1149 {"beige" , PALETTERGB (245,245,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1150 {"wheat" , PALETTERGB (245,222,179)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1151 {"sandy brown" , PALETTERGB (244,164, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1152 {"SandyBrown" , PALETTERGB (244,164, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1153 {"tan" , PALETTERGB (210,180,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1154 {"chocolate" , PALETTERGB (210,105, 30)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1155 {"firebrick" , PALETTERGB (178,34, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1156 {"brown" , PALETTERGB (165,42, 42)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1157 {"dark salmon" , PALETTERGB (233,150,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1158 {"DarkSalmon" , PALETTERGB (233,150,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1159 {"salmon" , PALETTERGB (250,128,114)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1160 {"light salmon" , PALETTERGB (255,160,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1161 {"LightSalmon" , PALETTERGB (255,160,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1162 {"orange" , PALETTERGB (255,165, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1163 {"dark orange" , PALETTERGB (255,140, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1164 {"DarkOrange" , PALETTERGB (255,140, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1165 {"coral" , PALETTERGB (255,127, 80)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1166 {"light coral" , PALETTERGB (240,128,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1167 {"LightCoral" , PALETTERGB (240,128,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1168 {"tomato" , PALETTERGB (255, 99, 71)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1169 {"orange red" , PALETTERGB (255, 69, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1170 {"OrangeRed" , PALETTERGB (255, 69, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1171 {"red" , PALETTERGB (255, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1172 {"hot pink" , PALETTERGB (255,105,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1173 {"HotPink" , PALETTERGB (255,105,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1174 {"deep pink" , PALETTERGB (255, 20,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1175 {"DeepPink" , PALETTERGB (255, 20,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1176 {"pink" , PALETTERGB (255,192,203)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1177 {"light pink" , PALETTERGB (255,182,193)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1178 {"LightPink" , PALETTERGB (255,182,193)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1179 {"pale violet red" , PALETTERGB (219,112,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1180 {"PaleVioletRed" , PALETTERGB (219,112,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1181 {"maroon" , PALETTERGB (176, 48, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1182 {"medium violet red" , PALETTERGB (199, 21,133)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1183 {"MediumVioletRed" , PALETTERGB (199, 21,133)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1184 {"violet red" , PALETTERGB (208, 32,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1185 {"VioletRed" , PALETTERGB (208, 32,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1186 {"magenta" , PALETTERGB (255, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1187 {"violet" , PALETTERGB (238,130,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1188 {"plum" , PALETTERGB (221,160,221)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1189 {"orchid" , PALETTERGB (218,112,214)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1190 {"medium orchid" , PALETTERGB (186, 85,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1191 {"MediumOrchid" , PALETTERGB (186, 85,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1192 {"dark orchid" , PALETTERGB (153, 50,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1193 {"DarkOrchid" , PALETTERGB (153, 50,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1194 {"dark violet" , PALETTERGB (148, 0,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1195 {"DarkViolet" , PALETTERGB (148, 0,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1196 {"blue violet" , PALETTERGB (138, 43,226)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1197 {"BlueViolet" , PALETTERGB (138, 43,226)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1198 {"purple" , PALETTERGB (160, 32,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1199 {"medium purple" , PALETTERGB (147,112,219)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1200 {"MediumPurple" , PALETTERGB (147,112,219)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1201 {"thistle" , PALETTERGB (216,191,216)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1202 {"gray0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1203 {"grey0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1204 {"dark grey" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1205 {"DarkGrey" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1206 {"dark gray" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1207 {"DarkGray" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1208 {"dark blue" , PALETTERGB ( 0, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1209 {"DarkBlue" , PALETTERGB ( 0, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1210 {"dark cyan" , PALETTERGB ( 0,139,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1211 {"DarkCyan" , PALETTERGB ( 0,139,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1212 {"dark magenta" , PALETTERGB (139, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1213 {"DarkMagenta" , PALETTERGB (139, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1214 {"dark red" , PALETTERGB (139, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1215 {"DarkRed" , PALETTERGB (139, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1216 {"light green" , PALETTERGB (144,238,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1217 {"LightGreen" , PALETTERGB (144,238,144)}, |
13434 | 1218 }; |
1219 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1220 DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map, |
13434 | 1221 0, 0, 0, "Return the default color map.") |
1222 () | |
1223 { | |
1224 int i; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1225 colormap_t *pc = w32_color_map; |
13434 | 1226 Lisp_Object cmap; |
1227 | |
1228 BLOCK_INPUT; | |
1229 | |
1230 cmap = Qnil; | |
1231 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1232 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]); |
13434 | 1233 pc++, i++) |
1234 cmap = Fcons (Fcons (build_string (pc->name), | |
1235 make_number (pc->colorref)), | |
1236 cmap); | |
1237 | |
1238 UNBLOCK_INPUT; | |
1239 | |
1240 return (cmap); | |
1241 } | |
1242 | |
1243 Lisp_Object | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1244 w32_to_x_color (rgb) |
13434 | 1245 Lisp_Object rgb; |
1246 { | |
1247 Lisp_Object color; | |
1248 | |
1249 CHECK_NUMBER (rgb, 0); | |
1250 | |
1251 BLOCK_INPUT; | |
1252 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1253 color = Frassq (rgb, Vw32_color_map); |
13434 | 1254 |
1255 UNBLOCK_INPUT; | |
1256 | |
1257 if (!NILP (color)) | |
1258 return (Fcar (color)); | |
1259 else | |
1260 return Qnil; | |
1261 } | |
1262 | |
1263 COLORREF | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1264 x_to_w32_color (colorname) |
13434 | 1265 char * colorname; |
1266 { | |
1267 register Lisp_Object tail, ret = Qnil; | |
1268 | |
1269 BLOCK_INPUT; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1270 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1271 if (colorname[0] == '#') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1272 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1273 /* Could be an old-style RGB Device specification. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1274 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1275 int size; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1276 color = colorname + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1277 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1278 size = strlen(color); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1279 if (size == 3 || size == 6 || size == 9 || size == 12) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1280 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1281 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1282 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1283 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1284 size /= 3; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1285 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1286 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1287 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1288 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1289 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1290 char t; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1291 unsigned long value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1292 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1293 /* The check for 'x' in the following conditional takes into |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1294 account the fact that strtol allows a "0x" in front of |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1295 our numbers, and we don't. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1296 if (!isxdigit(color[0]) || color[1] == 'x') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1297 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1298 t = color[size]; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1299 color[size] = '\0'; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1300 value = strtoul(color, &end, 16); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1301 color[size] = t; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1302 if (errno == ERANGE || end - color != size) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1303 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1304 switch (size) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1305 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1306 case 1: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1307 value = value * 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1308 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1309 case 2: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1310 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1311 case 3: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1312 value /= 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1313 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1314 case 4: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1315 value /= 0x100; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1316 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1317 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1318 colorval |= (value << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1319 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1320 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1321 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1322 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1323 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1324 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1325 color = end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1326 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1327 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1328 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1329 else if (strnicmp(colorname, "rgb:", 4) == 0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1330 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1331 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1332 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1333 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1334 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1335 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1336 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1337 color = colorname + 4; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1338 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1339 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1340 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1341 unsigned long value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1342 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1343 /* The check for 'x' in the following conditional takes into |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1344 account the fact that strtol allows a "0x" in front of |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1345 our numbers, and we don't. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1346 if (!isxdigit(color[0]) || color[1] == 'x') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1347 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1348 value = strtoul(color, &end, 16); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1349 if (errno == ERANGE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1350 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1351 switch (end - color) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1352 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1353 case 1: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1354 value = value * 0x10 + value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1355 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1356 case 2: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1357 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1358 case 3: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1359 value /= 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1360 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1361 case 4: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1362 value /= 0x100; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1363 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1364 default: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1365 value = ULONG_MAX; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1366 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1367 if (value == ULONG_MAX) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1368 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1369 colorval |= (value << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1370 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1371 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1372 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1373 if (*end != '\0') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1374 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1375 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1376 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1377 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1378 if (*end != '/') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1379 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1380 color = end + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1381 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1382 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1383 else if (strnicmp(colorname, "rgbi:", 5) == 0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1384 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1385 /* This is an RGB Intensity specification. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1386 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1387 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1388 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1389 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1390 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1391 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1392 color = colorname + 5; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1393 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1394 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1395 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1396 double value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1397 UINT val; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1398 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1399 value = strtod(color, &end); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1400 if (errno == ERANGE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1401 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1402 if (value < 0.0 || value > 1.0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1403 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1404 val = (UINT)(0x100 * value); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1405 /* We used 0x100 instead of 0xFF to give an continuous |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1406 range between 0.0 and 1.0 inclusive. The next statement |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1407 fixes the 1.0 case. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1408 if (val == 0x100) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1409 val = 0xFF; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1410 colorval |= (val << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1411 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1412 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1413 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1414 if (*end != '\0') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1415 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1416 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1417 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1418 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1419 if (*end != '/') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1420 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1421 color = end + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1422 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1423 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1424 /* I am not going to attempt to handle any of the CIE color schemes |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1425 or TekHVC, since I don't know the algorithms for conversion to |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1426 RGB. */ |
13434 | 1427 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1428 for (tail = Vw32_color_map; !NILP (tail); tail = Fcdr (tail)) |
13434 | 1429 { |
1430 register Lisp_Object elt, tem; | |
1431 | |
1432 elt = Fcar (tail); | |
1433 if (!CONSP (elt)) continue; | |
1434 | |
1435 tem = Fcar (elt); | |
1436 | |
1437 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0) | |
1438 { | |
1439 ret = XUINT(Fcdr (elt)); | |
1440 break; | |
1441 } | |
1442 | |
1443 QUIT; | |
1444 } | |
1445 | |
1446 UNBLOCK_INPUT; | |
1447 | |
1448 return ret; | |
1449 } | |
1450 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1451 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1452 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1453 w32_regenerate_palette (FRAME_PTR f) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1454 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1455 struct w32_palette_entry * list; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1456 LOGPALETTE * log_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1457 HPALETTE new_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1458 int i; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1459 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1460 /* don't bother trying to create palette if not supported */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1461 if (! FRAME_W32_DISPLAY_INFO (f)->has_palette) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1462 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1463 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1464 log_palette = (LOGPALETTE *) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1465 alloca (sizeof (LOGPALETTE) + |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1466 FRAME_W32_DISPLAY_INFO (f)->num_colors * sizeof (PALETTEENTRY)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1467 log_palette->palVersion = 0x300; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1468 log_palette->palNumEntries = FRAME_W32_DISPLAY_INFO (f)->num_colors; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1469 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1470 list = FRAME_W32_DISPLAY_INFO (f)->color_list; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1471 for (i = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1472 i < FRAME_W32_DISPLAY_INFO (f)->num_colors; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1473 i++, list = list->next) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1474 log_palette->palPalEntry[i] = list->entry; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1475 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1476 new_palette = CreatePalette (log_palette); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1477 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1478 enter_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1479 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1480 if (FRAME_W32_DISPLAY_INFO (f)->palette) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1481 DeleteObject (FRAME_W32_DISPLAY_INFO (f)->palette); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1482 FRAME_W32_DISPLAY_INFO (f)->palette = new_palette; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1483 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1484 /* Realize display palette and garbage all frames. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1485 release_frame_dc (f, get_frame_dc (f)); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1486 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1487 leave_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1488 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1489 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1490 #define W32_COLOR(pe) RGB (pe.peRed, pe.peGreen, pe.peBlue) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1491 #define SET_W32_COLOR(pe, color) \ |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1492 do \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1493 { \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1494 pe.peRed = GetRValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1495 pe.peGreen = GetGValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1496 pe.peBlue = GetBValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1497 pe.peFlags = 0; \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1498 } while (0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1499 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1500 #if 0 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1501 /* Keep these around in case we ever want to track color usage. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1502 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1503 w32_map_color (FRAME_PTR f, COLORREF color) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1504 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1505 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1506 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1507 if (NILP (Vw32_enable_palette)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1508 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1509 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1510 /* check if color is already mapped */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1511 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1512 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1513 if (W32_COLOR (list->entry) == color) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1514 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1515 ++list->refcount; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1516 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1517 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1518 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1519 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1520 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1521 /* not already mapped, so add to list and recreate Windows palette */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1522 list = (struct w32_palette_entry *) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1523 xmalloc (sizeof (struct w32_palette_entry)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1524 SET_W32_COLOR (list->entry, color); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1525 list->refcount = 1; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1526 list->next = FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1527 FRAME_W32_DISPLAY_INFO (f)->color_list = list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1528 FRAME_W32_DISPLAY_INFO (f)->num_colors++; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1529 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1530 /* set flag that palette must be regenerated */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1531 FRAME_W32_DISPLAY_INFO (f)->regen_palette = TRUE; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1532 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1533 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1534 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1535 w32_unmap_color (FRAME_PTR f, COLORREF color) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1536 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1537 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1538 struct w32_palette_entry **prev = &FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1539 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1540 if (NILP (Vw32_enable_palette)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1541 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1542 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1543 /* check if color is already mapped */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1544 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1545 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1546 if (W32_COLOR (list->entry) == color) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1547 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1548 if (--list->refcount == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1549 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1550 *prev = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1551 xfree (list); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1552 FRAME_W32_DISPLAY_INFO (f)->num_colors--; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1553 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1554 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1555 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1556 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1557 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1558 prev = &list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1559 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1560 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1561 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1562 /* set flag that palette must be regenerated */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1563 FRAME_W32_DISPLAY_INFO (f)->regen_palette = TRUE; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1564 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1565 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1566 |
13434 | 1567 /* Decide if color named COLOR is valid for the display associated with |
1568 the selected frame; if so, return the rgb values in COLOR_DEF. | |
1569 If ALLOC is nonzero, allocate a new colormap cell. */ | |
1570 | |
1571 int | |
1572 defined_color (f, color, color_def, alloc) | |
1573 FRAME_PTR f; | |
1574 char *color; | |
1575 COLORREF *color_def; | |
1576 int alloc; | |
1577 { | |
1578 register Lisp_Object tem; | |
14353 | 1579 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1580 tem = x_to_w32_color (color); |
14353 | 1581 |
13434 | 1582 if (!NILP (tem)) |
1583 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1584 if (!NILP (Vw32_enable_palette)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1585 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1586 struct w32_palette_entry * entry = |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1587 FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1588 struct w32_palette_entry ** prev = |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1589 &FRAME_W32_DISPLAY_INFO (f)->color_list; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1590 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1591 /* check if color is already mapped */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1592 while (entry) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1593 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1594 if (W32_COLOR (entry->entry) == XUINT (tem)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1595 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1596 prev = &entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1597 entry = entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1598 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1599 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1600 if (entry == NULL && alloc) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1601 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1602 /* not already mapped, so add to list */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1603 entry = (struct w32_palette_entry *) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1604 xmalloc (sizeof (struct w32_palette_entry)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1605 SET_W32_COLOR (entry->entry, XUINT (tem)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1606 entry->next = NULL; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1607 *prev = entry; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1608 FRAME_W32_DISPLAY_INFO (f)->num_colors++; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1609 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1610 /* set flag that palette must be regenerated */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1611 FRAME_W32_DISPLAY_INFO (f)->regen_palette = TRUE; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1612 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1613 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1614 /* Ensure COLORREF value is snapped to nearest color in (default) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1615 palette by simulating the PALETTERGB macro. This works whether |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1616 or not the display device has a palette. */ |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
1617 *color_def = XUINT (tem) | 0x2000000; |
13434 | 1618 return 1; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1619 } |
13434 | 1620 else |
14353 | 1621 { |
1622 return 0; | |
1623 } | |
13434 | 1624 } |
1625 | |
1626 /* Given a string ARG naming a color, compute a pixel value from it | |
1627 suitable for screen F. | |
1628 If F is not a color screen, return DEF (default) regardless of what | |
1629 ARG says. */ | |
1630 | |
1631 int | |
1632 x_decode_color (f, arg, def) | |
1633 FRAME_PTR f; | |
1634 Lisp_Object arg; | |
1635 int def; | |
1636 { | |
1637 COLORREF cdef; | |
1638 | |
1639 CHECK_STRING (arg, 0); | |
1640 | |
1641 if (strcmp (XSTRING (arg)->data, "black") == 0) | |
1642 return BLACK_PIX_DEFAULT (f); | |
1643 else if (strcmp (XSTRING (arg)->data, "white") == 0) | |
1644 return WHITE_PIX_DEFAULT (f); | |
1645 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1646 if ((FRAME_W32_DISPLAY_INFO (f)->n_planes * FRAME_W32_DISPLAY_INFO (f)->n_cbits) == 1) |
13434 | 1647 return def; |
1648 | |
1649 /* defined_color is responsible for coping with failures | |
1650 by looking for a near-miss. */ | |
1651 if (defined_color (f, XSTRING (arg)->data, &cdef, 1)) | |
1652 return cdef; | |
1653 | |
1654 /* defined_color failed; return an ultimate default. */ | |
1655 return def; | |
1656 } | |
1657 | |
1658 /* Functions called only from `x_set_frame_param' | |
1659 to set individual parameters. | |
1660 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1661 If FRAME_W32_WINDOW (f) is 0, |
13434 | 1662 the frame is being created and its window does not exist yet. |
1663 In that case, just record the parameter's new value | |
1664 in the standard place; do not attempt to change the window. */ | |
1665 | |
1666 void | |
1667 x_set_foreground_color (f, arg, oldval) | |
1668 struct frame *f; | |
1669 Lisp_Object arg, oldval; | |
1670 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1671 f->output_data.w32->foreground_pixel |
13434 | 1672 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1673 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1674 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 1675 { |
1676 recompute_basic_faces (f); | |
1677 if (FRAME_VISIBLE_P (f)) | |
1678 redraw_frame (f); | |
1679 } | |
1680 } | |
1681 | |
1682 void | |
1683 x_set_background_color (f, arg, oldval) | |
1684 struct frame *f; | |
1685 Lisp_Object arg, oldval; | |
1686 { | |
1687 Pixmap temp; | |
1688 int mask; | |
1689 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1690 f->output_data.w32->background_pixel |
13434 | 1691 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); |
1692 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1693 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 1694 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1695 SetWindowLong (FRAME_W32_WINDOW (f), WND_BACKGROUND_INDEX, f->output_data.w32->background_pixel); |
13434 | 1696 |
1697 recompute_basic_faces (f); | |
1698 | |
1699 if (FRAME_VISIBLE_P (f)) | |
1700 redraw_frame (f); | |
1701 } | |
1702 } | |
1703 | |
1704 void | |
1705 x_set_mouse_color (f, arg, oldval) | |
1706 struct frame *f; | |
1707 Lisp_Object arg, oldval; | |
1708 { | |
1709 #if 0 | |
1710 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor; | |
17669
607e8ef61ed0
(x_set_mouse_color): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17632
diff
changeset
|
1711 #endif |
17632
d2915156a803
(x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents:
16884
diff
changeset
|
1712 int count; |
13434 | 1713 int mask_color; |
1714 | |
1715 if (!EQ (Qnil, arg)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1716 f->output_data.w32->mouse_pixel |
13434 | 1717 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1718 mask_color = f->output_data.w32->background_pixel; |
13434 | 1719 /* No invisible pointers. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1720 if (mask_color == f->output_data.w32->mouse_pixel |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1721 && mask_color == f->output_data.w32->background_pixel) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1722 f->output_data.w32->mouse_pixel = f->output_data.w32->foreground_pixel; |
13434 | 1723 |
1724 #if 0 | |
1725 BLOCK_INPUT; | |
1726 | |
1727 /* It's not okay to crash if the user selects a screwy cursor. */ | |
17632
d2915156a803
(x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents:
16884
diff
changeset
|
1728 count = x_catch_errors (FRAME_W32_DISPLAY (f)); |
13434 | 1729 |
1730 if (!EQ (Qnil, Vx_pointer_shape)) | |
1731 { | |
1732 CHECK_NUMBER (Vx_pointer_shape, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1733 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape)); |
13434 | 1734 } |
1735 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1736 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1737 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s"); |
13434 | 1738 |
1739 if (!EQ (Qnil, Vx_nontext_pointer_shape)) | |
1740 { | |
1741 CHECK_NUMBER (Vx_nontext_pointer_shape, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1742 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 1743 XINT (Vx_nontext_pointer_shape)); |
1744 } | |
1745 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1746 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_left_ptr); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1747 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); |
13434 | 1748 |
1749 if (!EQ (Qnil, Vx_mode_pointer_shape)) | |
1750 { | |
1751 CHECK_NUMBER (Vx_mode_pointer_shape, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1752 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 1753 XINT (Vx_mode_pointer_shape)); |
1754 } | |
1755 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1756 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1757 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s"); |
13434 | 1758 |
1759 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape)) | |
1760 { | |
1761 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0); | |
1762 cross_cursor | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1763 = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 1764 XINT (Vx_sensitive_text_pointer_shape)); |
1765 } | |
1766 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1767 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair); |
13434 | 1768 |
1769 /* Check and report errors with the above calls. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1770 x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s"); |
17632
d2915156a803
(x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents:
16884
diff
changeset
|
1771 x_uncatch_errors (FRAME_W32_DISPLAY (f), count); |
13434 | 1772 |
1773 { | |
1774 XColor fore_color, back_color; | |
1775 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1776 fore_color.pixel = f->output_data.w32->mouse_pixel; |
13434 | 1777 back_color.pixel = mask_color; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1778 XQueryColor (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1779 DefaultColormap (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1780 DefaultScreen (FRAME_W32_DISPLAY (f))), |
13434 | 1781 &fore_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1782 XQueryColor (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1783 DefaultColormap (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1784 DefaultScreen (FRAME_W32_DISPLAY (f))), |
13434 | 1785 &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1786 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor, |
13434 | 1787 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1788 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor, |
13434 | 1789 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1790 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor, |
13434 | 1791 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1792 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor, |
13434 | 1793 &fore_color, &back_color); |
1794 } | |
1795 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1796 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 1797 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1798 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor); |
13434 | 1799 } |
1800 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1801 if (cursor != f->output_data.w32->text_cursor && f->output_data.w32->text_cursor != 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1802 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->text_cursor); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1803 f->output_data.w32->text_cursor = cursor; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1804 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1805 if (nontext_cursor != f->output_data.w32->nontext_cursor |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1806 && f->output_data.w32->nontext_cursor != 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1807 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->nontext_cursor); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1808 f->output_data.w32->nontext_cursor = nontext_cursor; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1809 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1810 if (mode_cursor != f->output_data.w32->modeline_cursor |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1811 && f->output_data.w32->modeline_cursor != 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1812 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1813 f->output_data.w32->modeline_cursor = mode_cursor; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1814 if (cross_cursor != f->output_data.w32->cross_cursor |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1815 && f->output_data.w32->cross_cursor != 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1816 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1817 f->output_data.w32->cross_cursor = cross_cursor; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1818 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1819 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 1820 UNBLOCK_INPUT; |
1821 #endif | |
1822 } | |
1823 | |
1824 void | |
1825 x_set_cursor_color (f, arg, oldval) | |
1826 struct frame *f; | |
1827 Lisp_Object arg, oldval; | |
1828 { | |
1829 unsigned long fore_pixel; | |
1830 | |
1831 if (!EQ (Vx_cursor_fore_pixel, Qnil)) | |
1832 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, | |
1833 WHITE_PIX_DEFAULT (f)); | |
1834 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1835 fore_pixel = f->output_data.w32->background_pixel; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1836 f->output_data.w32->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
13434 | 1837 |
1838 /* Make sure that the cursor color differs from the background color. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1839 if (f->output_data.w32->cursor_pixel == f->output_data.w32->background_pixel) |
13434 | 1840 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1841 f->output_data.w32->cursor_pixel = f->output_data.w32->mouse_pixel; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1842 if (f->output_data.w32->cursor_pixel == fore_pixel) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1843 fore_pixel = f->output_data.w32->background_pixel; |
13434 | 1844 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1845 f->output_data.w32->cursor_foreground_pixel = fore_pixel; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1846 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1847 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 1848 { |
1849 if (FRAME_VISIBLE_P (f)) | |
1850 { | |
1851 x_display_cursor (f, 0); | |
1852 x_display_cursor (f, 1); | |
1853 } | |
1854 } | |
1855 } | |
1856 | |
1857 /* Set the border-color of frame F to value described by ARG. | |
1858 ARG can be a string naming a color. | |
1859 The border-color is used for the border that is drawn by the server. | |
1860 Note that this does not fully take effect if done before | |
1861 F has a window; it must be redone when the window is created. */ | |
1862 | |
1863 void | |
1864 x_set_border_color (f, arg, oldval) | |
1865 struct frame *f; | |
1866 Lisp_Object arg, oldval; | |
1867 { | |
1868 unsigned char *str; | |
1869 int pix; | |
1870 | |
1871 CHECK_STRING (arg, 0); | |
1872 str = XSTRING (arg)->data; | |
1873 | |
1874 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | |
1875 | |
1876 x_set_border_pixel (f, pix); | |
1877 } | |
1878 | |
1879 /* Set the border-color of frame F to pixel value PIX. | |
1880 Note that this does not fully take effect if done before | |
1881 F has an window. */ | |
1882 | |
1883 x_set_border_pixel (f, pix) | |
1884 struct frame *f; | |
1885 int pix; | |
1886 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1887 f->output_data.w32->border_pixel = pix; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1888 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1889 if (FRAME_W32_WINDOW (f) != 0 && f->output_data.w32->border_width > 0) |
13434 | 1890 { |
1891 if (FRAME_VISIBLE_P (f)) | |
1892 redraw_frame (f); | |
1893 } | |
1894 } | |
1895 | |
1896 void | |
1897 x_set_cursor_type (f, arg, oldval) | |
1898 FRAME_PTR f; | |
1899 Lisp_Object arg, oldval; | |
1900 { | |
1901 if (EQ (arg, Qbar)) | |
1902 { | |
1903 FRAME_DESIRED_CURSOR (f) = bar_cursor; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1904 f->output_data.w32->cursor_width = 2; |
13434 | 1905 } |
1906 else if (CONSP (arg) && EQ (XCONS (arg)->car, Qbar) | |
1907 && INTEGERP (XCONS (arg)->cdr)) | |
1908 { | |
1909 FRAME_DESIRED_CURSOR (f) = bar_cursor; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1910 f->output_data.w32->cursor_width = XINT (XCONS (arg)->cdr); |
13434 | 1911 } |
1912 else | |
1913 /* Treat anything unknown as "box cursor". | |
1914 It was bad to signal an error; people have trouble fixing | |
1915 .Xdefaults with Emacs, when it has something bad in it. */ | |
1916 FRAME_DESIRED_CURSOR (f) = filled_box_cursor; | |
1917 | |
1918 /* Make sure the cursor gets redrawn. This is overkill, but how | |
1919 often do people change cursor types? */ | |
1920 update_mode_lines++; | |
1921 } | |
1922 | |
1923 void | |
1924 x_set_icon_type (f, arg, oldval) | |
1925 struct frame *f; | |
1926 Lisp_Object arg, oldval; | |
1927 { | |
1928 #if 0 | |
1929 Lisp_Object tem; | |
1930 int result; | |
1931 | |
1932 if (STRINGP (arg)) | |
1933 { | |
1934 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
1935 return; | |
1936 } | |
1937 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
1938 return; | |
1939 | |
1940 BLOCK_INPUT; | |
1941 if (NILP (arg)) | |
1942 result = x_text_icon (f, | |
1943 (char *) XSTRING ((!NILP (f->icon_name) | |
1944 ? f->icon_name | |
1945 : f->name))->data); | |
1946 else | |
1947 result = x_bitmap_icon (f, arg); | |
1948 | |
1949 if (result) | |
1950 { | |
1951 UNBLOCK_INPUT; | |
1952 error ("No icon window available"); | |
1953 } | |
1954 | |
1955 /* If the window was unmapped (and its icon was mapped), | |
1956 the new icon is not mapped, so map the window in its stead. */ | |
1957 if (FRAME_VISIBLE_P (f)) | |
1958 { | |
1959 #ifdef USE_X_TOOLKIT | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1960 XtPopup (f->output_data.w32->widget, XtGrabNone); |
13434 | 1961 #endif |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1962 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f)); |
13434 | 1963 } |
1964 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1965 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 1966 UNBLOCK_INPUT; |
1967 #endif | |
1968 } | |
1969 | |
1970 /* Return non-nil if frame F wants a bitmap icon. */ | |
1971 | |
1972 Lisp_Object | |
1973 x_icon_type (f) | |
1974 FRAME_PTR f; | |
1975 { | |
1976 Lisp_Object tem; | |
1977 | |
1978 tem = assq_no_quit (Qicon_type, f->param_alist); | |
1979 if (CONSP (tem)) | |
1980 return XCONS (tem)->cdr; | |
1981 else | |
1982 return Qnil; | |
1983 } | |
1984 | |
1985 void | |
1986 x_set_icon_name (f, arg, oldval) | |
1987 struct frame *f; | |
1988 Lisp_Object arg, oldval; | |
1989 { | |
1990 Lisp_Object tem; | |
1991 int result; | |
1992 | |
1993 if (STRINGP (arg)) | |
1994 { | |
1995 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
1996 return; | |
1997 } | |
1998 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
1999 return; | |
2000 | |
2001 f->icon_name = arg; | |
2002 | |
2003 #if 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2004 if (f->output_data.w32->icon_bitmap != 0) |
13434 | 2005 return; |
2006 | |
2007 BLOCK_INPUT; | |
2008 | |
2009 result = x_text_icon (f, | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2010 (char *) XSTRING ((!NILP (f->icon_name) |
13434 | 2011 ? f->icon_name |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2012 : !NILP (f->title) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2013 ? f->title |
13434 | 2014 : f->name))->data); |
2015 | |
2016 if (result) | |
2017 { | |
2018 UNBLOCK_INPUT; | |
2019 error ("No icon window available"); | |
2020 } | |
2021 | |
2022 /* If the window was unmapped (and its icon was mapped), | |
2023 the new icon is not mapped, so map the window in its stead. */ | |
2024 if (FRAME_VISIBLE_P (f)) | |
2025 { | |
2026 #ifdef USE_X_TOOLKIT | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2027 XtPopup (f->output_data.w32->widget, XtGrabNone); |
13434 | 2028 #endif |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2029 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f)); |
13434 | 2030 } |
2031 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2032 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 2033 UNBLOCK_INPUT; |
2034 #endif | |
2035 } | |
2036 | |
2037 extern Lisp_Object x_new_font (); | |
2038 | |
2039 void | |
2040 x_set_font (f, arg, oldval) | |
2041 struct frame *f; | |
2042 Lisp_Object arg, oldval; | |
2043 { | |
2044 Lisp_Object result; | |
2045 | |
2046 CHECK_STRING (arg, 1); | |
2047 | |
2048 BLOCK_INPUT; | |
2049 result = x_new_font (f, XSTRING (arg)->data); | |
2050 UNBLOCK_INPUT; | |
2051 | |
2052 if (EQ (result, Qnil)) | |
2053 error ("Font \"%s\" is not defined", XSTRING (arg)->data); | |
2054 else if (EQ (result, Qt)) | |
2055 error ("the characters of the given font have varying widths"); | |
2056 else if (STRINGP (result)) | |
2057 { | |
2058 recompute_basic_faces (f); | |
2059 store_frame_param (f, Qfont, result); | |
2060 } | |
2061 else | |
2062 abort (); | |
2063 } | |
2064 | |
2065 void | |
2066 x_set_border_width (f, arg, oldval) | |
2067 struct frame *f; | |
2068 Lisp_Object arg, oldval; | |
2069 { | |
2070 CHECK_NUMBER (arg, 0); | |
2071 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2072 if (XINT (arg) == f->output_data.w32->border_width) |
13434 | 2073 return; |
2074 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2075 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2076 error ("Cannot change the border width of a window"); |
2077 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2078 f->output_data.w32->border_width = XINT (arg); |
13434 | 2079 } |
2080 | |
2081 void | |
2082 x_set_internal_border_width (f, arg, oldval) | |
2083 struct frame *f; | |
2084 Lisp_Object arg, oldval; | |
2085 { | |
2086 int mask; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2087 int old = f->output_data.w32->internal_border_width; |
13434 | 2088 |
2089 CHECK_NUMBER (arg, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2090 f->output_data.w32->internal_border_width = XINT (arg); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2091 if (f->output_data.w32->internal_border_width < 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2092 f->output_data.w32->internal_border_width = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2093 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2094 if (f->output_data.w32->internal_border_width == old) |
13434 | 2095 return; |
2096 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2097 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2098 { |
2099 BLOCK_INPUT; | |
2100 x_set_window_size (f, 0, f->width, f->height); | |
2101 UNBLOCK_INPUT; | |
2102 SET_FRAME_GARBAGED (f); | |
2103 } | |
2104 } | |
2105 | |
2106 void | |
2107 x_set_visibility (f, value, oldval) | |
2108 struct frame *f; | |
2109 Lisp_Object value, oldval; | |
2110 { | |
2111 Lisp_Object frame; | |
2112 XSETFRAME (frame, f); | |
2113 | |
2114 if (NILP (value)) | |
2115 Fmake_frame_invisible (frame, Qt); | |
2116 else if (EQ (value, Qicon)) | |
2117 Ficonify_frame (frame); | |
2118 else | |
2119 Fmake_frame_visible (frame); | |
2120 } | |
2121 | |
2122 void | |
2123 x_set_menu_bar_lines (f, value, oldval) | |
2124 struct frame *f; | |
2125 Lisp_Object value, oldval; | |
2126 { | |
2127 int nlines; | |
2128 int olines = FRAME_MENU_BAR_LINES (f); | |
2129 | |
2130 /* Right now, menu bars don't work properly in minibuf-only frames; | |
2131 most of the commands try to apply themselves to the minibuffer | |
2132 frame itslef, and get an error because you can't switch buffers | |
2133 in or split the minibuffer window. */ | |
2134 if (FRAME_MINIBUF_ONLY_P (f)) | |
2135 return; | |
2136 | |
2137 if (INTEGERP (value)) | |
2138 nlines = XINT (value); | |
2139 else | |
2140 nlines = 0; | |
2141 | |
2142 FRAME_MENU_BAR_LINES (f) = 0; | |
2143 if (nlines) | |
2144 FRAME_EXTERNAL_MENU_BAR (f) = 1; | |
2145 else | |
2146 { | |
2147 if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | |
2148 free_frame_menubar (f); | |
2149 FRAME_EXTERNAL_MENU_BAR (f) = 0; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2150 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2151 /* Adjust the frame size so that the client (text) dimensions |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2152 remain the same. This depends on FRAME_EXTERNAL_MENU_BAR being |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2153 set correctly. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2154 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
13434 | 2155 } |
2156 } | |
2157 | |
2158 /* Change the name of frame F to NAME. If NAME is nil, set F's name to | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2159 w32_id_name. |
13434 | 2160 |
2161 If EXPLICIT is non-zero, that indicates that lisp code is setting the | |
2162 name; if NAME is a string, set F's name to NAME and set | |
2163 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. | |
2164 | |
2165 If EXPLICIT is zero, that indicates that Emacs redisplay code is | |
2166 suggesting a new name, which lisp code should override; if | |
2167 F->explicit_name is set, ignore the new name; otherwise, set it. */ | |
2168 | |
2169 void | |
2170 x_set_name (f, name, explicit) | |
2171 struct frame *f; | |
2172 Lisp_Object name; | |
2173 int explicit; | |
2174 { | |
2175 /* Make sure that requests from lisp code override requests from | |
2176 Emacs redisplay code. */ | |
2177 if (explicit) | |
2178 { | |
2179 /* If we're switching from explicit to implicit, we had better | |
2180 update the mode lines and thereby update the title. */ | |
2181 if (f->explicit_name && NILP (name)) | |
2182 update_mode_lines = 1; | |
2183 | |
2184 f->explicit_name = ! NILP (name); | |
2185 } | |
2186 else if (f->explicit_name) | |
2187 return; | |
2188 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2189 /* If NAME is nil, set the name to the w32_id_name. */ |
13434 | 2190 if (NILP (name)) |
2191 { | |
2192 /* Check for no change needed in this very common case | |
2193 before we do any consing. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2194 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name, |
13434 | 2195 XSTRING (f->name)->data)) |
2196 return; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2197 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name); |
13434 | 2198 } |
2199 else | |
2200 CHECK_STRING (name, 0); | |
2201 | |
2202 /* Don't change the name if it's already NAME. */ | |
2203 if (! NILP (Fstring_equal (name, f->name))) | |
2204 return; | |
2205 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2206 f->name = name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2207 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2208 /* For setting the frame title, the title parameter should override |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2209 the name parameter. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2210 if (! NILP (f->title)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2211 name = f->title; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2212 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2213 if (FRAME_W32_WINDOW (f)) |
13434 | 2214 { |
2215 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2216 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); |
13434 | 2217 UNBLOCK_INPUT; |
2218 } | |
2219 } | |
2220 | |
2221 /* This function should be called when the user's lisp code has | |
2222 specified a name for the frame; the name will override any set by the | |
2223 redisplay code. */ | |
2224 void | |
2225 x_explicitly_set_name (f, arg, oldval) | |
2226 FRAME_PTR f; | |
2227 Lisp_Object arg, oldval; | |
2228 { | |
2229 x_set_name (f, arg, 1); | |
2230 } | |
2231 | |
2232 /* This function should be called by Emacs redisplay code to set the | |
2233 name; names set this way will never override names set by the user's | |
2234 lisp code. */ | |
2235 void | |
2236 x_implicitly_set_name (f, arg, oldval) | |
2237 FRAME_PTR f; | |
2238 Lisp_Object arg, oldval; | |
2239 { | |
2240 x_set_name (f, arg, 0); | |
2241 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2242 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2243 /* Change the title of frame F to NAME. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2244 If NAME is nil, use the frame name as the title. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2245 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2246 If EXPLICIT is non-zero, that indicates that lisp code is setting the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2247 name; if NAME is a string, set F's name to NAME and set |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2248 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2249 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2250 If EXPLICIT is zero, that indicates that Emacs redisplay code is |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2251 suggesting a new name, which lisp code should override; if |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2252 F->explicit_name is set, ignore the new name; otherwise, set it. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2253 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2254 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2255 x_set_title (f, name) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2256 struct frame *f; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2257 Lisp_Object name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2258 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2259 /* Don't change the title if it's already NAME. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2260 if (EQ (name, f->title)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2261 return; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2262 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2263 update_mode_lines = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2264 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2265 f->title = name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2266 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2267 if (NILP (name)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2268 name = f->name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2269 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2270 if (FRAME_W32_WINDOW (f)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2271 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2272 BLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2273 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2274 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2275 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2276 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2277 |
13434 | 2278 void |
2279 x_set_autoraise (f, arg, oldval) | |
2280 struct frame *f; | |
2281 Lisp_Object arg, oldval; | |
2282 { | |
2283 f->auto_raise = !EQ (Qnil, arg); | |
2284 } | |
2285 | |
2286 void | |
2287 x_set_autolower (f, arg, oldval) | |
2288 struct frame *f; | |
2289 Lisp_Object arg, oldval; | |
2290 { | |
2291 f->auto_lower = !EQ (Qnil, arg); | |
2292 } | |
2293 | |
2294 void | |
2295 x_set_unsplittable (f, arg, oldval) | |
2296 struct frame *f; | |
2297 Lisp_Object arg, oldval; | |
2298 { | |
2299 f->no_split = !NILP (arg); | |
2300 } | |
2301 | |
2302 void | |
2303 x_set_vertical_scroll_bars (f, arg, oldval) | |
2304 struct frame *f; | |
2305 Lisp_Object arg, oldval; | |
2306 { | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2307 if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2308 || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2309 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2310 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f))) |
13434 | 2311 { |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2312 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ? |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2313 vertical_scroll_bar_none : |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2314 EQ (Qright, arg) |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2315 ? vertical_scroll_bar_right |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2316 : vertical_scroll_bar_left; |
13434 | 2317 |
2318 /* We set this parameter before creating the window for the | |
2319 frame, so we can get the geometry right from the start. | |
2320 However, if the window hasn't been created yet, we shouldn't | |
2321 call x_set_window_size. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2322 if (FRAME_W32_WINDOW (f)) |
13434 | 2323 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
2324 } | |
2325 } | |
2326 | |
2327 void | |
2328 x_set_scroll_bar_width (f, arg, oldval) | |
2329 struct frame *f; | |
2330 Lisp_Object arg, oldval; | |
2331 { | |
2332 if (NILP (arg)) | |
2333 { | |
2334 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0; | |
2335 FRAME_SCROLL_BAR_COLS (f) = 2; | |
2336 } | |
2337 else if (INTEGERP (arg) && XINT (arg) > 0 | |
2338 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f)) | |
2339 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2340 int wid = FONT_WIDTH (f->output_data.w32->font); |
13434 | 2341 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg); |
2342 FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2343 if (FRAME_W32_WINDOW (f)) |
13434 | 2344 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
2345 } | |
2346 } | |
2347 | |
2348 /* Subroutines of creating an frame. */ | |
2349 | |
2350 /* Make sure that Vx_resource_name is set to a reasonable value. | |
2351 Fix it up, or set it to `emacs' if it is too hopeless. */ | |
2352 | |
2353 static void | |
2354 validate_x_resource_name () | |
2355 { | |
2356 int len; | |
2357 /* Number of valid characters in the resource name. */ | |
2358 int good_count = 0; | |
2359 /* Number of invalid characters in the resource name. */ | |
2360 int bad_count = 0; | |
2361 Lisp_Object new; | |
2362 int i; | |
2363 | |
2364 if (STRINGP (Vx_resource_name)) | |
2365 { | |
2366 unsigned char *p = XSTRING (Vx_resource_name)->data; | |
2367 int i; | |
2368 | |
2369 len = XSTRING (Vx_resource_name)->size; | |
2370 | |
2371 /* Only letters, digits, - and _ are valid in resource names. | |
2372 Count the valid characters and count the invalid ones. */ | |
2373 for (i = 0; i < len; i++) | |
2374 { | |
2375 int c = p[i]; | |
2376 if (! ((c >= 'a' && c <= 'z') | |
2377 || (c >= 'A' && c <= 'Z') | |
2378 || (c >= '0' && c <= '9') | |
2379 || c == '-' || c == '_')) | |
2380 bad_count++; | |
2381 else | |
2382 good_count++; | |
2383 } | |
2384 } | |
2385 else | |
2386 /* Not a string => completely invalid. */ | |
2387 bad_count = 5, good_count = 0; | |
2388 | |
2389 /* If name is valid already, return. */ | |
2390 if (bad_count == 0) | |
2391 return; | |
2392 | |
2393 /* If name is entirely invalid, or nearly so, use `emacs'. */ | |
2394 if (good_count == 0 | |
2395 || (good_count == 1 && bad_count > 0)) | |
2396 { | |
2397 Vx_resource_name = build_string ("emacs"); | |
2398 return; | |
2399 } | |
2400 | |
2401 /* Name is partly valid. Copy it and replace the invalid characters | |
2402 with underscores. */ | |
2403 | |
2404 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name); | |
2405 | |
2406 for (i = 0; i < len; i++) | |
2407 { | |
2408 int c = XSTRING (new)->data[i]; | |
2409 if (! ((c >= 'a' && c <= 'z') | |
2410 || (c >= 'A' && c <= 'Z') | |
2411 || (c >= '0' && c <= '9') | |
2412 || c == '-' || c == '_')) | |
2413 XSTRING (new)->data[i] = '_'; | |
2414 } | |
2415 } | |
2416 | |
2417 | |
2418 extern char *x_get_string_resource (); | |
2419 | |
2420 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0, | |
2421 "Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.\n\ | |
2422 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the\n\ | |
2423 class, where INSTANCE is the name under which Emacs was invoked, or\n\ | |
2424 the name specified by the `-name' or `-rn' command-line arguments.\n\ | |
2425 \n\ | |
2426 The optional arguments COMPONENT and SUBCLASS add to the key and the\n\ | |
2427 class, respectively. You must specify both of them or neither.\n\ | |
2428 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\ | |
2429 and the class is `Emacs.CLASS.SUBCLASS'.") | |
2430 (attribute, class, component, subclass) | |
2431 Lisp_Object attribute, class, component, subclass; | |
2432 { | |
2433 register char *value; | |
2434 char *name_key; | |
2435 char *class_key; | |
2436 | |
2437 CHECK_STRING (attribute, 0); | |
2438 CHECK_STRING (class, 0); | |
2439 | |
2440 if (!NILP (component)) | |
2441 CHECK_STRING (component, 1); | |
2442 if (!NILP (subclass)) | |
2443 CHECK_STRING (subclass, 2); | |
2444 if (NILP (component) != NILP (subclass)) | |
2445 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | |
2446 | |
2447 validate_x_resource_name (); | |
2448 | |
2449 /* Allocate space for the components, the dots which separate them, | |
2450 and the final '\0'. Make them big enough for the worst case. */ | |
2451 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size | |
2452 + (STRINGP (component) | |
2453 ? XSTRING (component)->size : 0) | |
2454 + XSTRING (attribute)->size | |
2455 + 3); | |
2456 | |
2457 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
2458 + XSTRING (class)->size | |
2459 + (STRINGP (subclass) | |
2460 ? XSTRING (subclass)->size : 0) | |
2461 + 3); | |
2462 | |
2463 /* Start with emacs.FRAMENAME for the name (the specific one) | |
2464 and with `Emacs' for the class key (the general one). */ | |
2465 strcpy (name_key, XSTRING (Vx_resource_name)->data); | |
2466 strcpy (class_key, EMACS_CLASS); | |
2467 | |
2468 strcat (class_key, "."); | |
2469 strcat (class_key, XSTRING (class)->data); | |
2470 | |
2471 if (!NILP (component)) | |
2472 { | |
2473 strcat (class_key, "."); | |
2474 strcat (class_key, XSTRING (subclass)->data); | |
2475 | |
2476 strcat (name_key, "."); | |
2477 strcat (name_key, XSTRING (component)->data); | |
2478 } | |
2479 | |
2480 strcat (name_key, "."); | |
2481 strcat (name_key, XSTRING (attribute)->data); | |
2482 | |
2483 value = x_get_string_resource (Qnil, | |
2484 name_key, class_key); | |
2485 | |
2486 if (value != (char *) 0) | |
2487 return build_string (value); | |
2488 else | |
2489 return Qnil; | |
2490 } | |
2491 | |
2492 /* Used when C code wants a resource value. */ | |
2493 | |
2494 char * | |
2495 x_get_resource_string (attribute, class) | |
2496 char *attribute, *class; | |
2497 { | |
2498 register char *value; | |
2499 char *name_key; | |
2500 char *class_key; | |
2501 | |
2502 /* Allocate space for the components, the dots which separate them, | |
2503 and the final '\0'. */ | |
2504 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size | |
2505 + strlen (attribute) + 2); | |
2506 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
2507 + strlen (class) + 2); | |
2508 | |
2509 sprintf (name_key, "%s.%s", | |
2510 XSTRING (Vinvocation_name)->data, | |
2511 attribute); | |
2512 sprintf (class_key, "%s.%s", EMACS_CLASS, class); | |
2513 | |
2514 return x_get_string_resource (selected_frame, | |
2515 name_key, class_key); | |
2516 } | |
2517 | |
2518 /* Types we might convert a resource string into. */ | |
2519 enum resource_types | |
2520 { | |
2521 number, boolean, string, symbol | |
2522 }; | |
2523 | |
2524 /* Return the value of parameter PARAM. | |
2525 | |
2526 First search ALIST, then Vdefault_frame_alist, then the X defaults | |
2527 database, using ATTRIBUTE as the attribute name and CLASS as its class. | |
2528 | |
2529 Convert the resource to the type specified by desired_type. | |
2530 | |
2531 If no default is specified, return Qunbound. If you call | |
2532 x_get_arg, make sure you deal with Qunbound in a reasonable way, | |
2533 and don't let it get stored in any Lisp-visible variables! */ | |
2534 | |
2535 static Lisp_Object | |
2536 x_get_arg (alist, param, attribute, class, type) | |
2537 Lisp_Object alist, param; | |
2538 char *attribute; | |
2539 char *class; | |
2540 enum resource_types type; | |
2541 { | |
2542 register Lisp_Object tem; | |
2543 | |
2544 tem = Fassq (param, alist); | |
2545 if (EQ (tem, Qnil)) | |
2546 tem = Fassq (param, Vdefault_frame_alist); | |
2547 if (EQ (tem, Qnil)) | |
2548 { | |
2549 | |
2550 if (attribute) | |
2551 { | |
2552 tem = Fx_get_resource (build_string (attribute), | |
2553 build_string (class), | |
2554 Qnil, Qnil); | |
2555 | |
2556 if (NILP (tem)) | |
2557 return Qunbound; | |
2558 | |
2559 switch (type) | |
2560 { | |
2561 case number: | |
2562 return make_number (atoi (XSTRING (tem)->data)); | |
2563 | |
2564 case boolean: | |
2565 tem = Fdowncase (tem); | |
2566 if (!strcmp (XSTRING (tem)->data, "on") | |
2567 || !strcmp (XSTRING (tem)->data, "true")) | |
2568 return Qt; | |
2569 else | |
2570 return Qnil; | |
2571 | |
2572 case string: | |
2573 return tem; | |
2574 | |
2575 case symbol: | |
2576 /* As a special case, we map the values `true' and `on' | |
2577 to Qt, and `false' and `off' to Qnil. */ | |
2578 { | |
2579 Lisp_Object lower; | |
2580 lower = Fdowncase (tem); | |
2581 if (!strcmp (XSTRING (lower)->data, "on") | |
2582 || !strcmp (XSTRING (lower)->data, "true")) | |
2583 return Qt; | |
2584 else if (!strcmp (XSTRING (lower)->data, "off") | |
2585 || !strcmp (XSTRING (lower)->data, "false")) | |
2586 return Qnil; | |
2587 else | |
2588 return Fintern (tem, Qnil); | |
2589 } | |
2590 | |
2591 default: | |
2592 abort (); | |
2593 } | |
2594 } | |
2595 else | |
2596 return Qunbound; | |
2597 } | |
2598 return Fcdr (tem); | |
2599 } | |
2600 | |
2601 /* Record in frame F the specified or default value according to ALIST | |
2602 of the parameter named PARAM (a Lisp symbol). | |
2603 If no value is specified for PARAM, look for an X default for XPROP | |
2604 on the frame named NAME. | |
2605 If that is not found either, use the value DEFLT. */ | |
2606 | |
2607 static Lisp_Object | |
2608 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) | |
2609 struct frame *f; | |
2610 Lisp_Object alist; | |
2611 Lisp_Object prop; | |
2612 Lisp_Object deflt; | |
2613 char *xprop; | |
2614 char *xclass; | |
2615 enum resource_types type; | |
2616 { | |
2617 Lisp_Object tem; | |
2618 | |
2619 tem = x_get_arg (alist, prop, xprop, xclass, type); | |
2620 if (EQ (tem, Qunbound)) | |
2621 tem = deflt; | |
2622 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); | |
2623 return tem; | |
2624 } | |
2625 | |
2626 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0, | |
2627 "Parse an X-style geometry string STRING.\n\ | |
2628 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\ | |
2629 The properties returned may include `top', `left', `height', and `width'.\n\ | |
2630 The value of `left' or `top' may be an integer,\n\ | |
2631 or a list (+ N) meaning N pixels relative to top/left corner,\n\ | |
2632 or a list (- N) meaning -N pixels relative to bottom/right corner.") | |
2633 (string) | |
2634 Lisp_Object string; | |
2635 { | |
2636 int geometry, x, y; | |
2637 unsigned int width, height; | |
2638 Lisp_Object result; | |
2639 | |
2640 CHECK_STRING (string, 0); | |
2641 | |
2642 geometry = XParseGeometry ((char *) XSTRING (string)->data, | |
2643 &x, &y, &width, &height); | |
2644 | |
2645 result = Qnil; | |
2646 if (geometry & XValue) | |
2647 { | |
2648 Lisp_Object element; | |
2649 | |
2650 if (x >= 0 && (geometry & XNegative)) | |
2651 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil))); | |
2652 else if (x < 0 && ! (geometry & XNegative)) | |
2653 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil))); | |
2654 else | |
2655 element = Fcons (Qleft, make_number (x)); | |
2656 result = Fcons (element, result); | |
2657 } | |
2658 | |
2659 if (geometry & YValue) | |
2660 { | |
2661 Lisp_Object element; | |
2662 | |
2663 if (y >= 0 && (geometry & YNegative)) | |
2664 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil))); | |
2665 else if (y < 0 && ! (geometry & YNegative)) | |
2666 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil))); | |
2667 else | |
2668 element = Fcons (Qtop, make_number (y)); | |
2669 result = Fcons (element, result); | |
2670 } | |
2671 | |
2672 if (geometry & WidthValue) | |
2673 result = Fcons (Fcons (Qwidth, make_number (width)), result); | |
2674 if (geometry & HeightValue) | |
2675 result = Fcons (Fcons (Qheight, make_number (height)), result); | |
2676 | |
2677 return result; | |
2678 } | |
2679 | |
2680 /* Calculate the desired size and position of this window, | |
2681 and return the flags saying which aspects were specified. | |
2682 | |
2683 This function does not make the coordinates positive. */ | |
2684 | |
2685 #define DEFAULT_ROWS 40 | |
2686 #define DEFAULT_COLS 80 | |
2687 | |
2688 static int | |
2689 x_figure_window_size (f, parms) | |
2690 struct frame *f; | |
2691 Lisp_Object parms; | |
2692 { | |
2693 register Lisp_Object tem0, tem1, tem2; | |
2694 int height, width, left, top; | |
2695 register int geometry; | |
2696 long window_prompting = 0; | |
2697 | |
2698 /* Default values if we fall through. | |
2699 Actually, if that happens we should get | |
2700 window manager prompting. */ | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2701 SET_FRAME_WIDTH (f, DEFAULT_COLS); |
13434 | 2702 f->height = DEFAULT_ROWS; |
2703 /* Window managers expect that if program-specified | |
2704 positions are not (0,0), they're intentional, not defaults. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2705 f->output_data.w32->top_pos = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2706 f->output_data.w32->left_pos = 0; |
13434 | 2707 |
2708 tem0 = x_get_arg (parms, Qheight, 0, 0, number); | |
2709 tem1 = x_get_arg (parms, Qwidth, 0, 0, number); | |
2710 tem2 = x_get_arg (parms, Quser_size, 0, 0, number); | |
2711 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | |
2712 { | |
2713 if (!EQ (tem0, Qunbound)) | |
2714 { | |
2715 CHECK_NUMBER (tem0, 0); | |
2716 f->height = XINT (tem0); | |
2717 } | |
2718 if (!EQ (tem1, Qunbound)) | |
2719 { | |
2720 CHECK_NUMBER (tem1, 0); | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2721 SET_FRAME_WIDTH (f, XINT (tem1)); |
13434 | 2722 } |
2723 if (!NILP (tem2) && !EQ (tem2, Qunbound)) | |
2724 window_prompting |= USSize; | |
2725 else | |
2726 window_prompting |= PSize; | |
2727 } | |
2728 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2729 f->output_data.w32->vertical_scroll_bar_extra |
13434 | 2730 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
2731 ? 0 | |
2732 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
2733 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2734 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2735 f->output_data.w32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2736 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); |
13434 | 2737 |
2738 tem0 = x_get_arg (parms, Qtop, 0, 0, number); | |
2739 tem1 = x_get_arg (parms, Qleft, 0, 0, number); | |
2740 tem2 = x_get_arg (parms, Quser_position, 0, 0, number); | |
2741 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | |
2742 { | |
2743 if (EQ (tem0, Qminus)) | |
2744 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2745 f->output_data.w32->top_pos = 0; |
13434 | 2746 window_prompting |= YNegative; |
2747 } | |
2748 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus) | |
2749 && CONSP (XCONS (tem0)->cdr) | |
2750 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car)) | |
2751 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2752 f->output_data.w32->top_pos = - XINT (XCONS (XCONS (tem0)->cdr)->car); |
13434 | 2753 window_prompting |= YNegative; |
2754 } | |
2755 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus) | |
2756 && CONSP (XCONS (tem0)->cdr) | |
2757 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car)) | |
2758 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2759 f->output_data.w32->top_pos = XINT (XCONS (XCONS (tem0)->cdr)->car); |
13434 | 2760 } |
2761 else if (EQ (tem0, Qunbound)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2762 f->output_data.w32->top_pos = 0; |
13434 | 2763 else |
2764 { | |
2765 CHECK_NUMBER (tem0, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2766 f->output_data.w32->top_pos = XINT (tem0); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2767 if (f->output_data.w32->top_pos < 0) |
13434 | 2768 window_prompting |= YNegative; |
2769 } | |
2770 | |
2771 if (EQ (tem1, Qminus)) | |
2772 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2773 f->output_data.w32->left_pos = 0; |
13434 | 2774 window_prompting |= XNegative; |
2775 } | |
2776 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus) | |
2777 && CONSP (XCONS (tem1)->cdr) | |
2778 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car)) | |
2779 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2780 f->output_data.w32->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car); |
13434 | 2781 window_prompting |= XNegative; |
2782 } | |
2783 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus) | |
2784 && CONSP (XCONS (tem1)->cdr) | |
2785 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car)) | |
2786 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2787 f->output_data.w32->left_pos = XINT (XCONS (XCONS (tem1)->cdr)->car); |
13434 | 2788 } |
2789 else if (EQ (tem1, Qunbound)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2790 f->output_data.w32->left_pos = 0; |
13434 | 2791 else |
2792 { | |
2793 CHECK_NUMBER (tem1, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2794 f->output_data.w32->left_pos = XINT (tem1); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2795 if (f->output_data.w32->left_pos < 0) |
13434 | 2796 window_prompting |= XNegative; |
2797 } | |
2798 | |
2799 if (!NILP (tem2) && ! EQ (tem2, Qunbound)) | |
2800 window_prompting |= USPosition; | |
2801 else | |
2802 window_prompting |= PPosition; | |
2803 } | |
2804 | |
2805 return window_prompting; | |
2806 } | |
2807 | |
2808 | |
2809 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2810 extern LRESULT CALLBACK w32_wnd_proc (); |
13434 | 2811 |
2812 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2813 w32_init_class (hinst) |
13434 | 2814 HINSTANCE hinst; |
2815 { | |
2816 WNDCLASS wc; | |
2817 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2818 wc.style = CS_HREDRAW | CS_VREDRAW; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2819 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc; |
13434 | 2820 wc.cbClsExtra = 0; |
2821 wc.cbWndExtra = WND_EXTRA_BYTES; | |
2822 wc.hInstance = hinst; | |
2823 wc.hIcon = LoadIcon (hinst, EMACS_CLASS); | |
2824 wc.hCursor = LoadCursor (NULL, IDC_ARROW); | |
2825 wc.hbrBackground = NULL; // GetStockObject (WHITE_BRUSH); | |
2826 wc.lpszMenuName = NULL; | |
2827 wc.lpszClassName = EMACS_CLASS; | |
2828 | |
2829 return (RegisterClass (&wc)); | |
2830 } | |
2831 | |
2832 HWND | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2833 w32_createscrollbar (f, bar) |
13434 | 2834 struct frame *f; |
2835 struct scroll_bar * bar; | |
2836 { | |
2837 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, | |
2838 /* Position and size of scroll bar. */ | |
2839 XINT(bar->left), XINT(bar->top), | |
2840 XINT(bar->width), XINT(bar->height), | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2841 FRAME_W32_WINDOW (f), |
13434 | 2842 NULL, |
2843 hinst, | |
2844 NULL)); | |
2845 } | |
2846 | |
2847 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2848 w32_createwindow (f) |
13434 | 2849 struct frame *f; |
2850 { | |
2851 HWND hwnd; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2852 RECT rect; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2853 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2854 rect.left = rect.top = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2855 rect.right = PIXEL_WIDTH (f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2856 rect.bottom = PIXEL_HEIGHT (f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2857 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2858 AdjustWindowRect (&rect, f->output_data.w32->dwStyle, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2859 FRAME_EXTERNAL_MENU_BAR (f)); |
13434 | 2860 |
2861 /* Do first time app init */ | |
2862 | |
2863 if (!hprevinst) | |
2864 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2865 w32_init_class (hinst); |
13434 | 2866 } |
2867 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2868 FRAME_W32_WINDOW (f) = hwnd |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2869 = CreateWindow (EMACS_CLASS, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2870 f->namebuf, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2871 f->output_data.w32->dwStyle | WS_CLIPCHILDREN, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2872 f->output_data.w32->left_pos, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2873 f->output_data.w32->top_pos, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2874 rect.right - rect.left, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2875 rect.bottom - rect.top, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2876 NULL, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2877 NULL, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2878 hinst, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2879 NULL); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2880 |
13434 | 2881 if (hwnd) |
2882 { | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2883 SetWindowLong (hwnd, WND_FONTWIDTH_INDEX, FONT_WIDTH (f->output_data.w32->font)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2884 SetWindowLong (hwnd, WND_LINEHEIGHT_INDEX, f->output_data.w32->line_height); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2885 SetWindowLong (hwnd, WND_BORDER_INDEX, f->output_data.w32->internal_border_width); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2886 SetWindowLong (hwnd, WND_SCROLLBAR_INDEX, f->output_data.w32->vertical_scroll_bar_extra); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2887 SetWindowLong (hwnd, WND_BACKGROUND_INDEX, f->output_data.w32->background_pixel); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2888 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2889 /* Do this to discard the default setting specified by our parent. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2890 ShowWindow (hwnd, SW_HIDE); |
13434 | 2891 } |
2892 } | |
2893 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2894 /* Convert between the modifier bits W32 uses and the modifier bits |
13434 | 2895 Emacs uses. */ |
2896 unsigned int | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2897 w32_get_modifiers () |
13434 | 2898 { |
2899 return (((GetKeyState (VK_SHIFT)&0x8000) ? shift_modifier : 0) | | |
2900 ((GetKeyState (VK_CONTROL)&0x8000) ? ctrl_modifier : 0) | | |
15459
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
2901 ((GetKeyState (VK_MENU)&0x8000) ? |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2902 ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier) : 0)); |
13434 | 2903 } |
2904 | |
2905 void | |
2906 my_post_msg (wmsg, hwnd, msg, wParam, lParam) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2907 W32Msg * wmsg; |
13434 | 2908 HWND hwnd; |
2909 UINT msg; | |
2910 WPARAM wParam; | |
2911 LPARAM lParam; | |
2912 { | |
2913 wmsg->msg.hwnd = hwnd; | |
2914 wmsg->msg.message = msg; | |
2915 wmsg->msg.wParam = wParam; | |
2916 wmsg->msg.lParam = lParam; | |
2917 wmsg->msg.time = GetMessageTime (); | |
2918 | |
2919 post_msg (wmsg); | |
2920 } | |
2921 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
2922 /* GetKeyState and MapVirtualKey on Windows 95 do not actually distinguish |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2923 between left and right keys as advertised. We test for this |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2924 support dynamically, and set a flag when the support is absent. If |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2925 absent, we keep track of the left and right control and alt keys |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2926 ourselves. This is particularly necessary on keyboards that rely |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2927 upon the AltGr key, which is represented as having the left control |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2928 and right alt keys pressed. For these keyboards, we need to know |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2929 when the left alt key has been pressed in addition to the AltGr key |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2930 so that we can properly support M-AltGr-key sequences (such as M-@ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2931 on Swedish keyboards). */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2932 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2933 #define EMACS_LCONTROL 0 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2934 #define EMACS_RCONTROL 1 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2935 #define EMACS_LMENU 2 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2936 #define EMACS_RMENU 3 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2937 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2938 static int modifiers[4]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2939 static int modifiers_recorded; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2940 static int modifier_key_support_tested; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2941 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2942 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2943 test_modifier_support (unsigned int wparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2944 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2945 unsigned int l, r; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2946 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2947 if (wparam != VK_CONTROL && wparam != VK_MENU) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2948 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2949 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2950 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2951 l = VK_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2952 r = VK_RCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2953 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2954 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2955 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2956 l = VK_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2957 r = VK_RMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2958 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2959 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000)) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2960 modifiers_recorded = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2961 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2962 modifiers_recorded = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2963 modifier_key_support_tested = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2964 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2965 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2966 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2967 record_keydown (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2968 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2969 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2970 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2971 if (!modifier_key_support_tested) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2972 test_modifier_support (wparam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2973 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2974 if ((wparam != VK_CONTROL && wparam != VK_MENU) || !modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2975 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2976 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2977 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2978 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2979 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2980 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2981 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2982 modifiers[i] = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2983 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2984 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2985 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2986 record_keyup (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2987 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2988 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2989 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2990 if ((wparam != VK_CONTROL && wparam != VK_MENU) || !modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2991 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2992 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2993 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2994 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2995 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2996 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2997 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2998 modifiers[i] = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
2999 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3000 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3001 /* Emacs can lose focus while a modifier key has been pressed. When |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3002 it regains focus, be conservative and clear all modifiers since |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3003 we cannot reconstruct the left and right modifier state. */ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3004 static void |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3005 reset_modifiers () |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3006 { |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3007 SHORT ctrl, alt; |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3008 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3009 if (!modifiers_recorded) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3010 return; |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3011 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3012 ctrl = GetAsyncKeyState (VK_CONTROL); |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3013 alt = GetAsyncKeyState (VK_MENU); |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3014 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3015 if (ctrl == 0 || alt == 0) |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3016 /* Emacs doesn't have keyboard focus. Do nothing. */ |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3017 return; |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3018 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3019 if (!(ctrl & 0x08000)) |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3020 /* Clear any recorded control modifier state. */ |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3021 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3022 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3023 if (!(alt & 0x08000)) |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3024 /* Clear any recorded alt modifier state. */ |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3025 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3026 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3027 /* Otherwise, leave the modifier state as it was when Emacs lost |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3028 keyboard focus. */ |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3029 } |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3030 |
15377
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3031 /* Synchronize modifier state with what is reported with the current |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3032 keystroke. Even if we cannot distinguish between left and right |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3033 modifier keys, we know that, if no modifiers are set, then neither |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3034 the left or right modifier should be set. */ |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3035 static void |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3036 sync_modifiers () |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3037 { |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3038 if (!modifiers_recorded) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3039 return; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3040 |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3041 if (!(GetKeyState (VK_CONTROL) & 0x8000)) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3042 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3043 |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3044 if (!(GetKeyState (VK_MENU) & 0x8000)) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3045 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3046 } |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3047 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3048 static int |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3049 modifier_set (int vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3050 { |
15280
f39684fddaff
(modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents:
15232
diff
changeset
|
3051 if (vkey == VK_CAPITAL) |
f39684fddaff
(modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents:
15232
diff
changeset
|
3052 return (GetKeyState (vkey) & 0x1); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3053 if (!modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3054 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3055 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3056 switch (vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3057 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3058 case VK_LCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3059 return modifiers[EMACS_LCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3060 case VK_RCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3061 return modifiers[EMACS_RCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3062 case VK_LMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3063 return modifiers[EMACS_LMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3064 case VK_RMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3065 return modifiers[EMACS_RMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3066 default: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3067 break; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3068 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3069 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3070 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3071 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3072 /* We map the VK_* modifiers into console modifier constants |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3073 so that we can use the same routines to handle both console |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3074 and window input. */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3075 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3076 static int |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3077 construct_modifiers (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3078 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3079 int mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3080 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3081 if (wparam != VK_CONTROL && wparam != VK_MENU) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3082 mods = GetLastError (); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3083 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3084 mods = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3085 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3086 mods |= (modifier_set (VK_CAPITAL)) ? CAPSLOCK_ON : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3087 mods |= (modifier_set (VK_LCONTROL)) ? LEFT_CTRL_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3088 mods |= (modifier_set (VK_RCONTROL)) ? RIGHT_CTRL_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3089 mods |= (modifier_set (VK_LMENU)) ? LEFT_ALT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3090 mods |= (modifier_set (VK_RMENU)) ? RIGHT_ALT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3091 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3092 return mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3093 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3094 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3095 static unsigned int |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3096 map_keypad_keys (unsigned int wparam, unsigned int lparam) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3097 { |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3098 unsigned int extended = (lparam & 0x1000000L); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3099 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3100 if (wparam < VK_CLEAR || wparam > VK_DELETE) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3101 return wparam; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3102 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3103 if (wparam == VK_RETURN) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3104 return (extended ? VK_NUMPAD_ENTER : VK_RETURN); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3105 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3106 if (wparam >= VK_PRIOR && wparam <= VK_DOWN) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3107 return (!extended ? (VK_NUMPAD_PRIOR + (wparam - VK_PRIOR)) : wparam); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3108 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3109 if (wparam == VK_INSERT || wparam == VK_DELETE) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3110 return (!extended ? (VK_NUMPAD_INSERT + (wparam - VK_INSERT)) : wparam); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3111 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3112 if (wparam == VK_CLEAR) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3113 return (!extended ? VK_NUMPAD_CLEAR : wparam); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3114 |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3115 return wparam; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3116 } |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3117 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3118 /* Main message dispatch loop. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3119 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3120 static void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3121 w32_msg_pump (deferred_msg * msg_buf) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3122 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3123 MSG msg; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3124 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3125 while (GetMessage (&msg, NULL, 0, 0)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3126 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3127 if (msg.hwnd == NULL) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3128 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3129 switch (msg.message) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3130 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3131 case WM_EMACS_CREATEWINDOW: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3132 w32_createwindow ((struct frame *) msg.wParam); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3133 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3134 abort (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3135 break; |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3136 case WM_EMACS_SETLOCALE: |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3137 SetThreadLocale (msg.wParam); |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3138 /* Reply is not expected. */ |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3139 break; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3140 default: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3141 /* No need to be so draconian! */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3142 /* abort (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3143 DebPrint (("msg %x not expected by w32_msg_pump\n", msg.message)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3144 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3145 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3146 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3147 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3148 DispatchMessage (&msg); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3149 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3150 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3151 /* Exit nested loop when our deferred message has completed. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3152 if (msg_buf->completed) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3153 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3154 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3155 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3156 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3157 deferred_msg * deferred_msg_head; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3158 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3159 static deferred_msg * |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3160 find_deferred_msg (HWND hwnd, UINT msg) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3161 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3162 deferred_msg * item; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3163 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3164 /* Don't actually need synchronization for read access, since |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3165 modification of single pointer is always atomic. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3166 /* enter_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3167 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3168 for (item = deferred_msg_head; item != NULL; item = item->next) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3169 if (item->w32msg.msg.hwnd == hwnd |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3170 && item->w32msg.msg.message == msg) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3171 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3172 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3173 /* leave_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3174 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3175 return item; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3176 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3177 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3178 static LRESULT |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3179 send_deferred_msg (deferred_msg * msg_buf, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3180 HWND hwnd, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3181 UINT msg, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3182 WPARAM wParam, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3183 LPARAM lParam) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3184 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3185 /* Only input thread can send deferred messages. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3186 if (GetCurrentThreadId () != dwWindowsThreadId) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3187 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3188 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3189 /* It is an error to send a message that is already deferred. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3190 if (find_deferred_msg (hwnd, msg) != NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3191 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3192 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3193 /* Enforced synchronization is not needed because this is the only |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3194 function that alters deferred_msg_head, and the following critical |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3195 section is guaranteed to only be serially reentered (since only the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3196 input thread can call us). */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3197 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3198 /* enter_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3199 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3200 msg_buf->completed = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3201 msg_buf->next = deferred_msg_head; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3202 deferred_msg_head = msg_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3203 my_post_msg (&msg_buf->w32msg, hwnd, msg, wParam, lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3204 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3205 /* leave_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3206 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3207 /* Start a new nested message loop to process other messages until |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3208 this one is completed. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3209 w32_msg_pump (msg_buf); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3210 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3211 deferred_msg_head = msg_buf->next; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3212 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3213 return msg_buf->result; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3214 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3215 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3216 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3217 complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3218 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3219 deferred_msg * msg_buf = find_deferred_msg (hwnd, msg); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3220 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3221 if (msg_buf == NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3222 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3223 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3224 msg_buf->result = result; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3225 msg_buf->completed = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3226 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3227 /* Ensure input thread is woken so it notices the completion. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3228 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3229 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3230 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3231 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3232 DWORD |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3233 w32_msg_worker (dw) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3234 DWORD dw; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3235 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3236 MSG msg; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3237 deferred_msg dummy_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3238 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3239 /* Ensure our message queue is created */ |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3240 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3241 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3242 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3243 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3244 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3245 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3246 memset (&dummy_buf, 0, sizeof (dummy_buf)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3247 dummy_buf.w32msg.msg.hwnd = NULL; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3248 dummy_buf.w32msg.msg.message = WM_NULL; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3249 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3250 /* This is the inital message loop which should only exit when the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3251 application quits. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3252 w32_msg_pump (&dummy_buf); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3253 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3254 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3255 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3256 |
13434 | 3257 /* Main window procedure */ |
3258 | |
3259 extern char *lispy_function_keys[]; | |
3260 | |
3261 LRESULT CALLBACK | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3262 w32_wnd_proc (hwnd, msg, wParam, lParam) |
13434 | 3263 HWND hwnd; |
3264 UINT msg; | |
3265 WPARAM wParam; | |
3266 LPARAM lParam; | |
3267 { | |
3268 struct frame *f; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3269 struct w32_display_info *dpyinfo = &one_w32_display_info; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3270 W32Msg wmsg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3271 int windows_translate; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3272 |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3273 /* Note that it is okay to call x_window_to_frame, even though we are |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3274 not running in the main lisp thread, because frame deletion |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3275 requires the lisp thread to synchronize with this thread. Thus, if |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3276 a frame struct is returned, it can be used without concern that the |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3277 lisp thread might make it disappear while we are using it. |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3278 |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3279 NB. Walking the frame list in this thread is safe (as long as |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3280 writes of Lisp_Object slots are atomic, which they are on Windows). |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3281 Although delete-frame can destructively modify the frame list while |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3282 we are walking it, a garbage collection cannot occur until after |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3283 delete-frame has synchronized with this thread. |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3284 |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3285 It is also safe to use functions that make GDI calls, such as |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3286 w32_clear_rect, because these functions must obtain a DC handle |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3287 from the frame struct using get_frame_dc which is thread-aware. */ |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3288 |
13434 | 3289 switch (msg) |
3290 { | |
3291 case WM_ERASEBKGND: | |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3292 f = x_window_to_frame (dpyinfo, hwnd); |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3293 if (f) |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3294 { |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3295 GetUpdateRect (hwnd, &wmsg.rect, FALSE); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3296 w32_clear_rect (f, NULL, &wmsg.rect); |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3297 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3298 return 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3299 case WM_PALETTECHANGED: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3300 /* ignore our own changes */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3301 if ((HWND)wParam != hwnd) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3302 { |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3303 f = x_window_to_frame (dpyinfo, hwnd); |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3304 if (f) |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3305 /* get_frame_dc will realize our palette and force all |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3306 frames to be redrawn if needed. */ |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3307 release_frame_dc (f, get_frame_dc (f)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3308 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3309 return 0; |
13434 | 3310 case WM_PAINT: |
3311 { | |
3312 PAINTSTRUCT paintStruct; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3313 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3314 enter_crit (); |
13434 | 3315 BeginPaint (hwnd, &paintStruct); |
3316 wmsg.rect = paintStruct.rcPaint; | |
3317 EndPaint (hwnd, &paintStruct); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3318 leave_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3319 |
13434 | 3320 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
3321 | |
3322 return (0); | |
3323 } | |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3324 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3325 case WM_KEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3326 case WM_SYSKEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3327 record_keyup (wParam, lParam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3328 goto dflt; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3329 |
13434 | 3330 case WM_KEYDOWN: |
3331 case WM_SYSKEYDOWN: | |
15377
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3332 /* Synchronize modifiers with current keystroke. */ |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3333 sync_modifiers (); |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3334 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3335 record_keydown (wParam, lParam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3336 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3337 wParam = map_keypad_keys (wParam, lParam); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3338 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3339 windows_translate = 0; |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3340 switch (wParam) { |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3341 case VK_LWIN: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3342 case VK_RWIN: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3343 case VK_APPS: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3344 /* More support for these keys will likely be necessary. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3345 if (!NILP (Vw32_pass_optional_keys_to_system)) |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3346 windows_translate = 1; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3347 break; |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3348 case VK_MENU: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3349 if (NILP (Vw32_pass_alt_to_system)) |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3350 return 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3351 windows_translate = 1; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3352 break; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3353 case VK_CONTROL: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3354 case VK_CAPITAL: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3355 case VK_SHIFT: |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3356 case VK_NUMLOCK: |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3357 case VK_SCROLL: |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3358 windows_translate = 1; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3359 break; |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3360 default: |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3361 /* If not defined as a function key, change it to a WM_CHAR message. */ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3362 if (lispy_function_keys[wParam] == 0) |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3363 msg = WM_CHAR; |
14353 | 3364 break; |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3365 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3366 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3367 if (windows_translate) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3368 { |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3369 MSG windows_msg = { hwnd, msg, wParam, lParam, 0, {0,0} }; |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3370 |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3371 windows_msg.time = GetMessageTime (); |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3372 TranslateMessage (&windows_msg); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3373 goto dflt; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3374 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3375 |
13434 | 3376 /* Fall through */ |
3377 | |
3378 case WM_SYSCHAR: | |
3379 case WM_CHAR: | |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3380 wmsg.dwModifiers = construct_modifiers (wParam, lParam); |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3381 |
15232
4c4924843e34
(win32_wnd_proc): Reenable quit_char detection.
Richard M. Stallman <rms@gnu.org>
parents:
15206
diff
changeset
|
3382 #if 1 |
16602
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3383 /* Detect quit_char and set quit-flag directly. Note that we |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3384 still need to post a message to ensure the main thread will be |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3385 woken up if blocked in sys_select(), but we do NOT want to post |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3386 the quit_char message itself (because it will usually be as if |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3387 the user had typed quit_char twice). Instead, we post a dummy |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3388 message that has no particular effect. */ |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3389 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3390 int c = wParam; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3391 if (isalpha (c) && (wmsg.dwModifiers == LEFT_CTRL_PRESSED |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3392 || wmsg.dwModifiers == RIGHT_CTRL_PRESSED)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3393 c = make_ctrl_char (c) & 0377; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3394 if (c == quit_char) |
16602
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3395 { |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3396 Vquit_flag = Qt; |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3397 |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3398 /* The choice of message is somewhat arbitrary, as long as |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3399 the main thread handler just ignores it. */ |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3400 msg = WM_QUIT; |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3401 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3402 } |
15206
16d0e8c36378
(win32_wnd_proc): Disable setting of Vquit_flag
Geoff Voelker <voelker@cs.washington.edu>
parents:
15205
diff
changeset
|
3403 #endif |
16d0e8c36378
(win32_wnd_proc): Disable setting of Vquit_flag
Geoff Voelker <voelker@cs.washington.edu>
parents:
15205
diff
changeset
|
3404 |
16602
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3405 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
510d37fcbaf6
(w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
3406 |
13434 | 3407 break; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3408 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3409 /* Simulate middle mouse button events when left and right buttons |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3410 are used together, but only if user has two button mouse. */ |
13434 | 3411 case WM_LBUTTONDOWN: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3412 case WM_RBUTTONDOWN: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3413 if (XINT (Vw32_num_mouse_buttons) == 3) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3414 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3415 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3416 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3417 int this = (msg == WM_LBUTTONDOWN) ? LMOUSE : RMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3418 int other = (msg == WM_LBUTTONDOWN) ? RMOUSE : LMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3419 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
3420 if (button_state & this) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
3421 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3422 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3423 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3424 SetCapture (hwnd); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3425 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3426 button_state |= this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3427 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3428 if (button_state & other) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3429 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3430 if (mouse_button_timer) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3431 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3432 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3433 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3434 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3435 /* Generate middle mouse event instead. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3436 msg = WM_MBUTTONDOWN; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3437 button_state |= MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3438 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3439 else if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3440 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3441 /* Ignore button event if we've already generated a |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3442 middle mouse down event. This happens if the |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3443 user releases and press one of the two buttons |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3444 after we've faked a middle mouse event. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3445 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3446 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3447 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3448 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3449 /* Flush out saved message. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3450 post_msg (&saved_mouse_button_msg); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3451 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3452 wmsg.dwModifiers = w32_get_modifiers (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3453 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3454 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3455 /* Clear message buffer. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3456 saved_mouse_button_msg.msg.hwnd = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3457 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3458 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3459 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3460 /* Hold onto message for now. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3461 mouse_button_timer = |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3462 SetTimer (hwnd, MOUSE_BUTTON_ID, XINT (Vw32_mouse_button_tolerance), NULL); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3463 saved_mouse_button_msg.msg.hwnd = hwnd; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3464 saved_mouse_button_msg.msg.message = msg; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3465 saved_mouse_button_msg.msg.wParam = wParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3466 saved_mouse_button_msg.msg.lParam = lParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3467 saved_mouse_button_msg.msg.time = GetMessageTime (); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3468 saved_mouse_button_msg.dwModifiers = w32_get_modifiers (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3469 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3470 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3471 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3472 |
13434 | 3473 case WM_LBUTTONUP: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3474 case WM_RBUTTONUP: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3475 if (XINT (Vw32_num_mouse_buttons) == 3) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3476 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3477 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3478 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3479 int this = (msg == WM_LBUTTONUP) ? LMOUSE : RMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3480 int other = (msg == WM_LBUTTONUP) ? RMOUSE : LMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3481 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
3482 if ((button_state & this) == 0) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
3483 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3484 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3485 button_state &= ~this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3486 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3487 if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3488 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3489 /* Only generate event when second button is released. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3490 if ((button_state & other) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3491 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3492 msg = WM_MBUTTONUP; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3493 button_state &= ~MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3494 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3495 if (button_state) abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3496 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3497 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3498 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3499 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3500 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3501 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3502 /* Flush out saved message if necessary. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3503 if (saved_mouse_button_msg.msg.hwnd) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3504 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3505 post_msg (&saved_mouse_button_msg); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3506 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3507 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3508 wmsg.dwModifiers = w32_get_modifiers (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3509 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3510 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3511 /* Always clear message buffer and cancel timer. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3512 saved_mouse_button_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3513 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3514 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3515 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3516 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3517 ReleaseCapture (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3518 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3519 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3520 |
13434 | 3521 case WM_MBUTTONDOWN: |
3522 case WM_MBUTTONUP: | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3523 handle_plain_button: |
13434 | 3524 { |
3525 BOOL up; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3526 int button; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3527 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3528 if (parse_button (msg, &button, &up)) |
13434 | 3529 { |
3530 if (up) ReleaseCapture (); | |
3531 else SetCapture (hwnd); | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3532 button = (button == 0) ? LMOUSE : |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3533 ((button == 1) ? MMOUSE : RMOUSE); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3534 if (up) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3535 button_state &= ~button; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3536 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3537 button_state |= button; |
13434 | 3538 } |
3539 } | |
3540 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3541 wmsg.dwModifiers = w32_get_modifiers (); |
13434 | 3542 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3543 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3544 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3545 case WM_VSCROLL: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3546 case WM_MOUSEMOVE: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3547 if (XINT (Vw32_mouse_move_interval) <= 0 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3548 || (msg == WM_MOUSEMOVE && button_state == 0)) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3549 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3550 wmsg.dwModifiers = w32_get_modifiers (); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3551 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3552 return 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3553 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3554 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3555 /* Hang onto mouse move and scroll messages for a bit, to avoid |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3556 sending such events to Emacs faster than it can process them. |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3557 If we get more events before the timer from the first message |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3558 expires, we just replace the first message. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3559 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3560 if (saved_mouse_move_msg.msg.hwnd == 0) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3561 mouse_move_timer = |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3562 SetTimer (hwnd, MOUSE_MOVE_ID, XINT (Vw32_mouse_move_interval), NULL); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3563 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3564 /* Hold onto message for now. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3565 saved_mouse_move_msg.msg.hwnd = hwnd; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3566 saved_mouse_move_msg.msg.message = msg; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3567 saved_mouse_move_msg.msg.wParam = wParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3568 saved_mouse_move_msg.msg.lParam = lParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3569 saved_mouse_move_msg.msg.time = GetMessageTime (); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3570 saved_mouse_move_msg.dwModifiers = w32_get_modifiers (); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3571 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3572 return 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3573 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3574 case WM_MOUSEWHEEL: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3575 wmsg.dwModifiers = w32_get_modifiers (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3576 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3577 return 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3578 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3579 case WM_TIMER: |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3580 /* Flush out saved messages if necessary. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3581 if (wParam == mouse_button_timer) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3582 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3583 if (saved_mouse_button_msg.msg.hwnd) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3584 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3585 post_msg (&saved_mouse_button_msg); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3586 saved_mouse_button_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3587 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3588 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3589 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3590 } |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3591 else if (wParam == mouse_move_timer) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3592 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3593 if (saved_mouse_move_msg.msg.hwnd) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3594 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3595 post_msg (&saved_mouse_move_msg); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3596 saved_mouse_move_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3597 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3598 KillTimer (hwnd, mouse_move_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3599 mouse_move_timer = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3600 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3601 return 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3602 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3603 case WM_NCACTIVATE: |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3604 /* Windows doesn't send us focus messages when putting up and |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3605 taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95. |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3606 The only indication we get that something happened is receiving |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3607 this message afterwards. So this is a good time to reset our |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3608 keyboard modifiers' state. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3609 reset_modifiers (); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3610 goto dflt; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3611 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3612 case WM_INITMENU: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3613 /* We must ensure menu bar is fully constructed and up to date |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3614 before allowing user interaction with it. To achieve this |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3615 we send this message to the lisp thread and wait for a |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3616 reply (whose value is not actually needed) to indicate that |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3617 the menu bar is now ready for use, so we can now return. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3618 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3619 To remain responsive in the meantime, we enter a nested message |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3620 loop that can process all other messages. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3621 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3622 However, we skip all this if the message results from calling |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3623 TrackPopupMenu - in fact, we must NOT attempt to send the lisp |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3624 thread a message because it is blocked on us at this point. We |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3625 set menubar_active before calling TrackPopupMenu to indicate |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3626 this (there is no possibility of confusion with real menubar |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3627 being active). */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3628 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3629 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3630 if (f |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3631 && (f->output_data.w32->menubar_active |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3632 /* We can receive this message even in the absence of a |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3633 menubar (ie. when the system menu is activated) - in this |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3634 case we do NOT want to forward the message, otherwise it |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3635 will cause the menubar to suddenly appear when the user |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3636 had requested it to be turned off! */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3637 || f->output_data.w32->menubar_widget == NULL)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3638 return 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3639 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3640 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3641 deferred_msg msg_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3642 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3643 /* Detect if message has already been deferred; in this case |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3644 we cannot return any sensible value to ignore this. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3645 if (find_deferred_msg (hwnd, msg) != NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3646 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3647 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3648 return send_deferred_msg (&msg_buf, hwnd, msg, wParam, lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3649 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3650 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3651 case WM_EXITMENULOOP: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3652 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3653 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3654 /* Indicate that menubar can be modified again. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3655 if (f) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3656 f->output_data.w32->menubar_active = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3657 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3658 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3659 #if 0 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3660 /* Still not right - can't distinguish between clicks in the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3661 client area of the frame from clicks forwarded from the scroll |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3662 bars - may have to hook WM_NCHITTEST to remember the mouse |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3663 position and then check if it is in the client area ourselves. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3664 case WM_MOUSEACTIVATE: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3665 /* Discard the mouse click that activates a frame, allowing the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3666 user to click anywhere without changing point (or worse!). |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3667 Don't eat mouse clicks on scrollbars though!! */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3668 if (LOWORD (lParam) == HTCLIENT ) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3669 return MA_ACTIVATEANDEAT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3670 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3671 #endif |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3672 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3673 case WM_ACTIVATE: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3674 case WM_ACTIVATEAPP: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3675 case WM_WINDOWPOSCHANGED: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3676 case WM_SHOWWINDOW: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3677 /* Inform lisp thread that a frame might have just been obscured |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3678 or exposed, so should recheck visibility of all frames. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3679 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3680 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3681 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3682 case WM_SETFOCUS: |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3683 reset_modifiers (); |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3684 case WM_KILLFOCUS: |
13434 | 3685 case WM_MOVE: |
3686 case WM_SIZE: | |
3687 case WM_COMMAND: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3688 wmsg.dwModifiers = w32_get_modifiers (); |
13434 | 3689 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
3690 goto dflt; | |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3691 |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3692 case WM_CLOSE: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3693 wmsg.dwModifiers = w32_get_modifiers (); |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3694 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3695 return 0; |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
3696 |
13434 | 3697 case WM_WINDOWPOSCHANGING: |
3698 { | |
3699 WINDOWPLACEMENT wp; | |
3700 LPWINDOWPOS lppos = (WINDOWPOS *) lParam; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3701 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3702 wp.length = sizeof (WINDOWPLACEMENT); |
13434 | 3703 GetWindowPlacement (hwnd, &wp); |
3704 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3705 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0) |
13434 | 3706 { |
3707 RECT rect; | |
3708 int wdiff; | |
3709 int hdiff; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3710 DWORD font_width; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3711 DWORD line_height; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3712 DWORD internal_border; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3713 DWORD scrollbar_extra; |
13434 | 3714 RECT wr; |
3715 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3716 wp.length = sizeof(wp); |
13434 | 3717 GetWindowRect (hwnd, &wr); |
3718 | |
14353 | 3719 enter_crit (); |
13434 | 3720 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3721 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3722 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3723 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3724 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX); |
13434 | 3725 |
14353 | 3726 leave_crit (); |
13434 | 3727 |
3728 memset (&rect, 0, sizeof (rect)); | |
3729 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE), | |
3730 GetMenu (hwnd) != NULL); | |
3731 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3732 /* Force width and height of client area to be exact |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3733 multiples of the character cell dimensions. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3734 wdiff = (lppos->cx - (rect.right - rect.left) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3735 - 2 * internal_border - scrollbar_extra) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3736 % font_width; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3737 hdiff = (lppos->cy - (rect.bottom - rect.top) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3738 - 2 * internal_border) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3739 % line_height; |
13434 | 3740 |
3741 if (wdiff || hdiff) | |
3742 { | |
3743 /* For right/bottom sizing we can just fix the sizes. | |
3744 However for top/left sizing we will need to fix the X | |
3745 and Y positions as well. */ | |
3746 | |
3747 lppos->cx -= wdiff; | |
3748 lppos->cy -= hdiff; | |
3749 | |
3750 if (wp.showCmd != SW_SHOWMAXIMIZED | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3751 && (lppos->flags & SWP_NOMOVE) == 0) |
13434 | 3752 { |
3753 if (lppos->x != wr.left || lppos->y != wr.top) | |
3754 { | |
3755 lppos->x += wdiff; | |
3756 lppos->y += hdiff; | |
3757 } | |
3758 else | |
3759 { | |
3760 lppos->flags |= SWP_NOMOVE; | |
3761 } | |
3762 } | |
3763 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3764 return 0; |
13434 | 3765 } |
3766 } | |
3767 } | |
3768 | |
3769 goto dflt; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3770 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3771 case WM_EMACS_CREATESCROLLBAR: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3772 return (LRESULT) w32_createscrollbar ((struct frame *) wParam, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3773 (struct scroll_bar *) lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3774 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3775 case WM_EMACS_SHOWWINDOW: |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3776 return ShowWindow ((HWND) wParam, (WPARAM) lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3777 |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3778 case WM_EMACS_SETFOREGROUND: |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3779 return SetForegroundWindow ((HWND) wParam); |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3780 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3781 case WM_EMACS_SETWINDOWPOS: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3782 { |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3783 WINDOWPOS * pos = (WINDOWPOS *) wParam; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3784 return SetWindowPos (hwnd, pos->hwndInsertAfter, |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3785 pos->x, pos->y, pos->cx, pos->cy, pos->flags); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3786 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3787 |
13434 | 3788 case WM_EMACS_DESTROYWINDOW: |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3789 return DestroyWindow ((HWND) wParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3790 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3791 case WM_EMACS_TRACKPOPUPMENU: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3792 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3793 UINT flags; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3794 POINT *pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3795 int retval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3796 pos = (POINT *)lParam; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3797 flags = TPM_CENTERALIGN; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3798 if (button_state & LMOUSE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3799 flags |= TPM_LEFTBUTTON; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3800 else if (button_state & RMOUSE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3801 flags |= TPM_RIGHTBUTTON; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3802 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3803 /* Use menubar_active to indicate that WM_INITMENU is from |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3804 TrackPopupMenu below, and should be ignored. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3805 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3806 if (f) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3807 f->output_data.w32->menubar_active = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3808 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3809 if (TrackPopupMenu ((HMENU)wParam, flags, pos->x, pos->y, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3810 0, hwnd, NULL)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3811 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3812 MSG amsg; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3813 /* Eat any mouse messages during popupmenu */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3814 while (PeekMessage (&amsg, hwnd, WM_MOUSEFIRST, WM_MOUSELAST, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3815 PM_REMOVE)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3816 /* Get the menu selection, if any */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3817 if (PeekMessage (&amsg, hwnd, WM_COMMAND, WM_COMMAND, PM_REMOVE)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3818 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3819 retval = LOWORD (amsg.wParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3820 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3821 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3822 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3823 retval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3824 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3825 button_state = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3826 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3827 /* Remember we did a SetCapture on the initial mouse down |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3828 event, but window focus will usually have changed to the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3829 popup menu before we released the mouse button. For |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3830 safety, we make sure the capture is cancelled now. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3831 ReleaseCapture (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3832 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3833 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3834 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3835 retval = -1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3836 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3837 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3838 return retval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3839 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3840 |
13434 | 3841 default: |
3842 dflt: | |
3843 return DefWindowProc (hwnd, msg, wParam, lParam); | |
3844 } | |
3845 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3846 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3847 /* The most common default return code for handled messages is 0. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3848 return 0; |
13434 | 3849 } |
3850 | |
3851 void | |
3852 my_create_window (f) | |
3853 struct frame * f; | |
3854 { | |
3855 MSG msg; | |
3856 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3857 if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3858 abort (); |
13434 | 3859 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
3860 } | |
3861 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3862 /* Create and set up the w32 window for frame F. */ |
13434 | 3863 |
3864 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3865 w32_window (f, window_prompting, minibuffer_only) |
13434 | 3866 struct frame *f; |
3867 long window_prompting; | |
3868 int minibuffer_only; | |
3869 { | |
3870 BLOCK_INPUT; | |
3871 | |
3872 /* Use the resource name as the top-level window name | |
3873 for looking up resources. Make a non-Lisp copy | |
3874 for the window manager, so GC relocation won't bother it. | |
3875 | |
3876 Elsewhere we specify the window name for the window manager. */ | |
3877 | |
3878 { | |
3879 char *str = (char *) XSTRING (Vx_resource_name)->data; | |
3880 f->namebuf = (char *) xmalloc (strlen (str) + 1); | |
3881 strcpy (f->namebuf, str); | |
3882 } | |
3883 | |
3884 my_create_window (f); | |
3885 | |
3886 validate_x_resource_name (); | |
3887 | |
3888 /* x_set_name normally ignores requests to set the name if the | |
3889 requested name is the same as the current name. This is the one | |
3890 place where that assumption isn't correct; f->name is set, but | |
3891 the server hasn't been told. */ | |
3892 { | |
3893 Lisp_Object name; | |
3894 int explicit = f->explicit_name; | |
3895 | |
3896 f->explicit_name = 0; | |
3897 name = f->name; | |
3898 f->name = Qnil; | |
3899 x_set_name (f, name, explicit); | |
3900 } | |
3901 | |
3902 UNBLOCK_INPUT; | |
3903 | |
3904 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) | |
3905 initialize_frame_menubar (f); | |
3906 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3907 if (FRAME_W32_WINDOW (f) == 0) |
13434 | 3908 error ("Unable to create window"); |
3909 } | |
3910 | |
3911 /* Handle the icon stuff for this window. Perhaps later we might | |
3912 want an x_set_icon_position which can be called interactively as | |
3913 well. */ | |
3914 | |
3915 static void | |
3916 x_icon (f, parms) | |
3917 struct frame *f; | |
3918 Lisp_Object parms; | |
3919 { | |
3920 Lisp_Object icon_x, icon_y; | |
3921 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3922 /* Set the position of the icon. Note that Windows 95 groups all |
13434 | 3923 icons in the tray. */ |
3924 icon_x = x_get_arg (parms, Qicon_left, 0, 0, number); | |
3925 icon_y = x_get_arg (parms, Qicon_top, 0, 0, number); | |
3926 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) | |
3927 { | |
3928 CHECK_NUMBER (icon_x, 0); | |
3929 CHECK_NUMBER (icon_y, 0); | |
3930 } | |
3931 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | |
3932 error ("Both left and top icon corners of icon must be specified"); | |
3933 | |
3934 BLOCK_INPUT; | |
3935 | |
3936 if (! EQ (icon_x, Qunbound)) | |
3937 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); | |
3938 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3939 #if 0 /* TODO */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3940 /* Start up iconic or window? */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3941 x_wm_set_window_state |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3942 (f, (EQ (x_get_arg (parms, Qvisibility, 0, 0, symbol), Qicon) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3943 ? IconicState |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3944 : NormalState)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3945 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3946 x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3947 ? f->icon_name |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3948 : f->name))->data); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3949 #endif |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3950 |
13434 | 3951 UNBLOCK_INPUT; |
3952 } | |
3953 | |
3954 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |
3955 1, 1, 0, | |
3956 "Make a new window, which is called a \"frame\" in Emacs terms.\n\ | |
3957 Returns an Emacs frame object.\n\ | |
3958 ALIST is an alist of frame parameters.\n\ | |
3959 If the parameters specify that the frame should not have a minibuffer,\n\ | |
3960 and do not specify a specific minibuffer window to use,\n\ | |
3961 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\ | |
3962 be shared by the new frame.\n\ | |
3963 \n\ | |
3964 This function is an internal primitive--use `make-frame' instead.") | |
3965 (parms) | |
3966 Lisp_Object parms; | |
3967 { | |
3968 struct frame *f; | |
3969 Lisp_Object frame, tem; | |
3970 Lisp_Object name; | |
3971 int minibuffer_only = 0; | |
3972 long window_prompting = 0; | |
3973 int width, height; | |
3974 int count = specpdl_ptr - specpdl; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3975 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
13434 | 3976 Lisp_Object display; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3977 struct w32_display_info *dpyinfo; |
13434 | 3978 Lisp_Object parent; |
3979 struct kboard *kb; | |
3980 | |
3981 /* Use this general default value to start with | |
3982 until we know if this frame has a specified name. */ | |
3983 Vx_resource_name = Vinvocation_name; | |
3984 | |
3985 display = x_get_arg (parms, Qdisplay, 0, 0, string); | |
3986 if (EQ (display, Qunbound)) | |
3987 display = Qnil; | |
3988 dpyinfo = check_x_display_info (display); | |
3989 #ifdef MULTI_KBOARD | |
3990 kb = dpyinfo->kboard; | |
3991 #else | |
3992 kb = &the_only_kboard; | |
3993 #endif | |
3994 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3995 name = x_get_arg (parms, Qname, "name", "Name", string); |
13434 | 3996 if (!STRINGP (name) |
3997 && ! EQ (name, Qunbound) | |
3998 && ! NILP (name)) | |
3999 error ("Invalid frame name--not a string or nil"); | |
4000 | |
4001 if (STRINGP (name)) | |
4002 Vx_resource_name = name; | |
4003 | |
4004 /* See if parent window is specified. */ | |
4005 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number); | |
4006 if (EQ (parent, Qunbound)) | |
4007 parent = Qnil; | |
4008 if (! NILP (parent)) | |
4009 CHECK_NUMBER (parent, 0); | |
4010 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4011 /* make_frame_without_minibuffer can run Lisp code and garbage collect. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4012 /* No need to protect DISPLAY because that's not used after passing |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4013 it to make_frame_without_minibuffer. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4014 frame = Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4015 GCPRO4 (parms, parent, name, frame); |
13434 | 4016 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol); |
4017 if (EQ (tem, Qnone) || NILP (tem)) | |
4018 f = make_frame_without_minibuffer (Qnil, kb, display); | |
4019 else if (EQ (tem, Qonly)) | |
4020 { | |
4021 f = make_minibuffer_frame (); | |
4022 minibuffer_only = 1; | |
4023 } | |
4024 else if (WINDOWP (tem)) | |
4025 f = make_frame_without_minibuffer (tem, kb, display); | |
4026 else | |
4027 f = make_frame (1); | |
4028 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4029 XSETFRAME (frame, f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4030 |
13434 | 4031 /* Note that Windows does support scroll bars. */ |
4032 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4033 /* By default, make scrollbars the system standard width. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4034 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL); |
13434 | 4035 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4036 f->output_method = output_w32; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4037 f->output_data.w32 = (struct w32_output *) xmalloc (sizeof (struct w32_output)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4038 bzero (f->output_data.w32, sizeof (struct w32_output)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4039 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4040 f->icon_name |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4041 = x_get_arg (parms, Qicon_name, "iconName", "Title", string); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4042 if (! STRINGP (f->icon_name)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4043 f->icon_name = Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4044 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4045 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ |
13434 | 4046 #ifdef MULTI_KBOARD |
4047 FRAME_KBOARD (f) = kb; | |
4048 #endif | |
4049 | |
4050 /* Specify the parent under which to make this window. */ | |
4051 | |
4052 if (!NILP (parent)) | |
4053 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4054 f->output_data.w32->parent_desc = (Window) parent; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4055 f->output_data.w32->explicit_parent = 1; |
13434 | 4056 } |
4057 else | |
4058 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4059 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4060 f->output_data.w32->explicit_parent = 0; |
13434 | 4061 } |
4062 | |
4063 /* Note that the frame has no physical cursor right now. */ | |
4064 f->phys_cursor_x = -1; | |
4065 | |
4066 /* Set the name; the functions to which we pass f expect the name to | |
4067 be set. */ | |
4068 if (EQ (name, Qunbound) || NILP (name)) | |
4069 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4070 f->name = build_string (dpyinfo->w32_id_name); |
13434 | 4071 f->explicit_name = 0; |
4072 } | |
4073 else | |
4074 { | |
4075 f->name = name; | |
4076 f->explicit_name = 1; | |
4077 /* use the frame's title when getting resources for this frame. */ | |
4078 specbind (Qx_resource_name, name); | |
4079 } | |
4080 | |
4081 /* Extract the window parameters from the supplied values | |
4082 that are needed to determine window geometry. */ | |
4083 { | |
4084 Lisp_Object font; | |
4085 | |
4086 font = x_get_arg (parms, Qfont, "font", "Font", string); | |
4087 BLOCK_INPUT; | |
4088 /* First, try whatever font the caller has specified. */ | |
4089 if (STRINGP (font)) | |
4090 font = x_new_font (f, XSTRING (font)->data); | |
4091 /* Try out a font which we hope has bold and italic variations. */ | |
4092 if (!STRINGP (font)) | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4093 font = x_new_font (f, "-*-Courier New-normal-r-*-*-13-97-*-*-c-*-*-ansi-"); |
13434 | 4094 if (! STRINGP (font)) |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4095 font = x_new_font (f, "-*-Courier-normal-r-*-*-13-97-*-*-c-*-*-ansi-"); |
13434 | 4096 /* If those didn't work, look for something which will at least work. */ |
4097 if (! STRINGP (font)) | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4098 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-13-97-*-*-c-*-*-ansi-"); |
13434 | 4099 UNBLOCK_INPUT; |
4100 if (! STRINGP (font)) | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4101 font = build_string ("Fixedsys"); |
13434 | 4102 |
4103 x_default_parameter (f, parms, Qfont, font, | |
4104 "font", "Font", string); | |
4105 } | |
4106 | |
4107 x_default_parameter (f, parms, Qborder_width, make_number (2), | |
4108 "borderwidth", "BorderWidth", number); | |
4109 /* This defaults to 2 in order to match xterm. We recognize either | |
4110 internalBorderWidth or internalBorder (which is what xterm calls | |
4111 it). */ | |
4112 if (NILP (Fassq (Qinternal_border_width, parms))) | |
4113 { | |
4114 Lisp_Object value; | |
4115 | |
4116 value = x_get_arg (parms, Qinternal_border_width, | |
4117 "internalBorder", "BorderWidth", number); | |
4118 if (! EQ (value, Qunbound)) | |
4119 parms = Fcons (Fcons (Qinternal_border_width, value), | |
4120 parms); | |
4121 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4122 /* Default internalBorderWidth to 0 on Windows to match other programs. */ |
13434 | 4123 x_default_parameter (f, parms, Qinternal_border_width, make_number (0), |
4124 "internalBorderWidth", "BorderWidth", number); | |
4125 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt, | |
4126 "verticalScrollBars", "ScrollBars", boolean); | |
4127 | |
4128 /* Also do the stuff which must be set before the window exists. */ | |
4129 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), | |
4130 "foreground", "Foreground", string); | |
4131 x_default_parameter (f, parms, Qbackground_color, build_string ("white"), | |
4132 "background", "Background", string); | |
4133 x_default_parameter (f, parms, Qmouse_color, build_string ("black"), | |
4134 "pointerColor", "Foreground", string); | |
4135 x_default_parameter (f, parms, Qcursor_color, build_string ("black"), | |
4136 "cursorColor", "Foreground", string); | |
4137 x_default_parameter (f, parms, Qborder_color, build_string ("black"), | |
4138 "borderColor", "BorderColor", string); | |
4139 | |
4140 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), | |
4141 "menuBar", "MenuBar", number); | |
4142 x_default_parameter (f, parms, Qscroll_bar_width, Qnil, | |
4143 "scrollBarWidth", "ScrollBarWidth", number); | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4144 x_default_parameter (f, parms, Qbuffer_predicate, Qnil, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4145 "bufferPredicate", "BufferPredicate", symbol); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4146 x_default_parameter (f, parms, Qtitle, Qnil, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4147 "title", "Title", string); |
13434 | 4148 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4149 f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4150 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
13434 | 4151 window_prompting = x_figure_window_size (f, parms); |
4152 | |
4153 if (window_prompting & XNegative) | |
4154 { | |
4155 if (window_prompting & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4156 f->output_data.w32->win_gravity = SouthEastGravity; |
13434 | 4157 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4158 f->output_data.w32->win_gravity = NorthEastGravity; |
13434 | 4159 } |
4160 else | |
4161 { | |
4162 if (window_prompting & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4163 f->output_data.w32->win_gravity = SouthWestGravity; |
13434 | 4164 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4165 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 4166 } |
4167 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4168 f->output_data.w32->size_hint_flags = window_prompting; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4169 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4170 w32_window (f, window_prompting, minibuffer_only); |
13434 | 4171 x_icon (f, parms); |
4172 init_frame_faces (f); | |
4173 | |
4174 /* We need to do this after creating the window, so that the | |
4175 icon-creation functions can say whose icon they're describing. */ | |
4176 x_default_parameter (f, parms, Qicon_type, Qnil, | |
4177 "bitmapIcon", "BitmapIcon", symbol); | |
4178 | |
4179 x_default_parameter (f, parms, Qauto_raise, Qnil, | |
4180 "autoRaise", "AutoRaiseLower", boolean); | |
4181 x_default_parameter (f, parms, Qauto_lower, Qnil, | |
4182 "autoLower", "AutoRaiseLower", boolean); | |
4183 x_default_parameter (f, parms, Qcursor_type, Qbox, | |
4184 "cursorType", "CursorType", symbol); | |
4185 | |
4186 /* Dimensions, especially f->height, must be done via change_frame_size. | |
4187 Change will not be effected unless different from the current | |
4188 f->height. */ | |
4189 width = f->width; | |
4190 height = f->height; | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
4191 f->height = 0; |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
4192 SET_FRAME_WIDTH (f, 0); |
13434 | 4193 change_frame_size (f, height, width, 1, 0); |
4194 | |
4195 /* Tell the server what size and position, etc, we want, | |
4196 and how badly we want them. */ | |
4197 BLOCK_INPUT; | |
4198 x_wm_set_size_hint (f, window_prompting, 0); | |
4199 UNBLOCK_INPUT; | |
4200 | |
4201 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean); | |
4202 f->no_split = minibuffer_only || EQ (tem, Qt); | |
4203 | |
4204 UNGCPRO; | |
4205 | |
4206 /* It is now ok to make the frame official | |
4207 even if we get an error below. | |
4208 And the frame needs to be on Vframe_list | |
4209 or making it visible won't work. */ | |
4210 Vframe_list = Fcons (frame, Vframe_list); | |
4211 | |
4212 /* Now that the frame is official, it counts as a reference to | |
4213 its display. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4214 FRAME_W32_DISPLAY_INFO (f)->reference_count++; |
13434 | 4215 |
4216 /* Make the window appear on the frame and enable display, | |
4217 unless the caller says not to. However, with explicit parent, | |
4218 Emacs cannot control visibility, so don't try. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4219 if (! f->output_data.w32->explicit_parent) |
13434 | 4220 { |
4221 Lisp_Object visibility; | |
4222 | |
4223 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol); | |
4224 if (EQ (visibility, Qunbound)) | |
4225 visibility = Qt; | |
4226 | |
4227 if (EQ (visibility, Qicon)) | |
4228 x_iconify_frame (f); | |
4229 else if (! NILP (visibility)) | |
4230 x_make_frame_visible (f); | |
4231 else | |
4232 /* Must have been Qnil. */ | |
4233 ; | |
4234 } | |
4235 | |
4236 return unbind_to (count, frame); | |
4237 } | |
4238 | |
4239 /* FRAME is used only to get a handle on the X display. We don't pass the | |
4240 display info directly because we're called from frame.c, which doesn't | |
4241 know about that structure. */ | |
4242 Lisp_Object | |
4243 x_get_focus_frame (frame) | |
4244 struct frame *frame; | |
4245 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4246 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame); |
13434 | 4247 Lisp_Object xfocus; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4248 if (! dpyinfo->w32_focus_frame) |
13434 | 4249 return Qnil; |
4250 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4251 XSETFRAME (xfocus, dpyinfo->w32_focus_frame); |
13434 | 4252 return xfocus; |
4253 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4254 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4255 DEFUN ("w32-focus-frame", Fw32_focus_frame, Sw32_focus_frame, 1, 1, 0, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4256 "Give FRAME input focus, raising to foreground if necessary.") |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4257 (frame) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4258 Lisp_Object frame; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4259 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4260 x_focus_on_frame (check_x_frame (frame)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4261 return Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4262 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4263 |
13434 | 4264 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4265 XFontStruct * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4266 w32_load_font (dpyinfo,name) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4267 struct w32_display_info *dpyinfo; |
14353 | 4268 char * name; |
13434 | 4269 { |
4270 XFontStruct * font = NULL; | |
4271 BOOL ok; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4272 |
14353 | 4273 { |
4274 LOGFONT lf; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4275 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4276 if (!name || !x_to_w32_font (name, &lf)) |
14353 | 4277 return (NULL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4278 |
14353 | 4279 font = (XFontStruct *) xmalloc (sizeof (XFontStruct)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4280 |
14353 | 4281 if (!font) return (NULL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4282 |
14353 | 4283 BLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4284 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4285 font->hfont = CreateFontIndirect (&lf); |
13434 | 4286 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4287 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4288 if (font->hfont == NULL) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4289 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4290 ok = FALSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4291 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4292 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4293 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4294 HDC hdc; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4295 HANDLE oldobj; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4296 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4297 hdc = GetDC (dpyinfo->root_window); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4298 oldobj = SelectObject (hdc, font->hfont); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4299 ok = GetTextMetrics (hdc, &font->tm); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4300 SelectObject (hdc, oldobj); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4301 ReleaseDC (dpyinfo->root_window, hdc); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4302 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4303 |
13434 | 4304 UNBLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4305 |
13434 | 4306 if (ok) return (font); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4307 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4308 w32_unload_font (dpyinfo, font); |
13434 | 4309 return (NULL); |
4310 } | |
4311 | |
4312 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4313 w32_unload_font (dpyinfo, font) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4314 struct w32_display_info *dpyinfo; |
13434 | 4315 XFontStruct * font; |
4316 { | |
4317 if (font) | |
4318 { | |
14353 | 4319 if (font->hfont) DeleteObject(font->hfont); |
13434 | 4320 xfree (font); |
4321 } | |
4322 } | |
4323 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4324 /* The font conversion stuff between x and w32 */ |
13434 | 4325 |
4326 /* X font string is as follows (from faces.el) | |
4327 * (let ((- "[-?]") | |
4328 * (foundry "[^-]+") | |
4329 * (family "[^-]+") | |
4330 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1 | |
4331 * (weight\? "\\([^-]*\\)") ; 1 | |
4332 * (slant "\\([ior]\\)") ; 2 | |
4333 * (slant\? "\\([^-]?\\)") ; 2 | |
4334 * (swidth "\\([^-]*\\)") ; 3 | |
4335 * (adstyle "[^-]*") ; 4 | |
4336 * (pixelsize "[0-9]+") | |
4337 * (pointsize "[0-9][0-9]+") | |
4338 * (resx "[0-9][0-9]+") | |
4339 * (resy "[0-9][0-9]+") | |
4340 * (spacing "[cmp?*]") | |
4341 * (avgwidth "[0-9]+") | |
4342 * (registry "[^-]+") | |
4343 * (encoding "[^-]+") | |
4344 * ) | |
4345 * (setq x-font-regexp | |
4346 * (concat "\\`\\*?[-?*]" | |
4347 * foundry - family - weight\? - slant\? - swidth - adstyle - | |
4348 * pixelsize - pointsize - resx - resy - spacing - registry - | |
4349 * encoding "[-?*]\\*?\\'" | |
4350 * )) | |
4351 * (setq x-font-regexp-head | |
4352 * (concat "\\`[-?*]" foundry - family - weight\? - slant\? | |
4353 * "\\([-*?]\\|\\'\\)")) | |
4354 * (setq x-font-regexp-slant (concat - slant -)) | |
4355 * (setq x-font-regexp-weight (concat - weight -)) | |
4356 * nil) | |
4357 */ | |
4358 | |
4359 #define FONT_START "[-?]" | |
4360 #define FONT_FOUNDRY "[^-]+" | |
4361 #define FONT_FAMILY "\\([^-]+\\)" /* 1 */ | |
4362 #define FONT_WEIGHT "\\(bold\\|demibold\\|medium\\)" /* 2 */ | |
4363 #define FONT_WEIGHT_Q "\\([^-]*\\)" /* 2 */ | |
4364 #define FONT_SLANT "\\([ior]\\)" /* 3 */ | |
4365 #define FONT_SLANT_Q "\\([^-]?\\)" /* 3 */ | |
4366 #define FONT_SWIDTH "\\([^-]*\\)" /* 4 */ | |
4367 #define FONT_ADSTYLE "[^-]*" | |
4368 #define FONT_PIXELSIZE "[^-]*" | |
4369 #define FONT_POINTSIZE "\\([0-9][0-9]+\\|\\*\\)" /* 5 */ | |
4370 #define FONT_RESX "[0-9][0-9]+" | |
4371 #define FONT_RESY "[0-9][0-9]+" | |
4372 #define FONT_SPACING "[cmp?*]" | |
4373 #define FONT_AVGWIDTH "[0-9]+" | |
4374 #define FONT_REGISTRY "[^-]+" | |
4375 #define FONT_ENCODING "[^-]+" | |
4376 | |
4377 #define FONT_REGEXP ("\\`\\*?[-?*]" \ | |
4378 FONT_FOUNDRY "-" \ | |
4379 FONT_FAMILY "-" \ | |
4380 FONT_WEIGHT_Q "-" \ | |
4381 FONT_SLANT_Q "-" \ | |
4382 FONT_SWIDTH "-" \ | |
4383 FONT_ADSTYLE "-" \ | |
4384 FONT_PIXELSIZE "-" \ | |
4385 FONT_POINTSIZE "-" \ | |
4386 "[-?*]\\|\\'") | |
4387 | |
4388 #define FONT_REGEXP_HEAD ("\\`[-?*]" \ | |
4389 FONT_FOUNDRY "-" \ | |
4390 FONT_FAMILY "-" \ | |
4391 FONT_WEIGHT_Q "-" \ | |
4392 FONT_SLANT_Q \ | |
4393 "\\([-*?]\\|\\'\\)") | |
4394 | |
4395 #define FONT_REGEXP_SLANT "-" FONT_SLANT "-" | |
4396 #define FONT_REGEXP_WEIGHT "-" FONT_WEIGHT "-" | |
4397 | |
4398 LONG | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4399 x_to_w32_weight (lpw) |
13434 | 4400 char * lpw; |
4401 { | |
4402 if (!lpw) return (FW_DONTCARE); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4403 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4404 if (stricmp (lpw,"heavy") == 0) return FW_HEAVY; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4405 else if (stricmp (lpw,"extrabold") == 0) return FW_EXTRABOLD; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4406 else if (stricmp (lpw,"bold") == 0) return FW_BOLD; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4407 else if (stricmp (lpw,"demibold") == 0) return FW_SEMIBOLD; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4408 else if (stricmp (lpw,"semibold") == 0) return FW_SEMIBOLD; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4409 else if (stricmp (lpw,"medium") == 0) return FW_MEDIUM; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4410 else if (stricmp (lpw,"normal") == 0) return FW_NORMAL; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4411 else if (stricmp (lpw,"light") == 0) return FW_LIGHT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4412 else if (stricmp (lpw,"extralight") == 0) return FW_EXTRALIGHT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4413 else if (stricmp (lpw,"thin") == 0) return FW_THIN; |
13434 | 4414 else |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4415 return FW_DONTCARE; |
13434 | 4416 } |
4417 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4418 |
13434 | 4419 char * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4420 w32_to_x_weight (fnweight) |
13434 | 4421 int fnweight; |
4422 { | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4423 if (fnweight >= FW_HEAVY) return "heavy"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4424 if (fnweight >= FW_EXTRABOLD) return "extrabold"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4425 if (fnweight >= FW_BOLD) return "bold"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4426 if (fnweight >= FW_SEMIBOLD) return "semibold"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4427 if (fnweight >= FW_MEDIUM) return "medium"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4428 if (fnweight >= FW_NORMAL) return "normal"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4429 if (fnweight >= FW_LIGHT) return "light"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4430 if (fnweight >= FW_EXTRALIGHT) return "extralight"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4431 if (fnweight >= FW_THIN) return "thin"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4432 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4433 return "*"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4434 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4435 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4436 LONG |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4437 x_to_w32_charset (lpcs) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4438 char * lpcs; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4439 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4440 if (!lpcs) return (0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4441 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4442 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4443 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4444 else if (stricmp (lpcs,"iso8859") == 0) return ANSI_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4445 else if (stricmp (lpcs,"oem") == 0) return OEM_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4446 #ifdef UNICODE_CHARSET |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4447 else if (stricmp (lpcs,"unicode") == 0) return UNICODE_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4448 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4449 #endif |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4450 else if (lpcs[0] == '#') return atoi (lpcs + 1); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4451 else |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4452 return DEFAULT_CHARSET; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4453 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4454 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4455 char * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4456 w32_to_x_charset (fncharset) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4457 int fncharset; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4458 { |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4459 static char buf[16]; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4460 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4461 switch (fncharset) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4462 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4463 case ANSI_CHARSET: return "ansi"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4464 case OEM_CHARSET: return "oem"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4465 case SYMBOL_CHARSET: return "symbol"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4466 #ifdef UNICODE_CHARSET |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4467 case UNICODE_CHARSET: return "unicode"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4468 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4469 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4470 /* Encode numerical value of unknown charset. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4471 sprintf (buf, "#%u", fncharset); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4472 return buf; |
13434 | 4473 } |
4474 | |
4475 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4476 w32_to_x_font (lplogfont, lpxstr, len) |
13434 | 4477 LOGFONT * lplogfont; |
4478 char * lpxstr; | |
4479 int len; | |
4480 { | |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4481 char height_pixels[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4482 char height_dpi[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4483 char width_pixels[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4484 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4485 if (!lpxstr) abort (); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4486 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4487 if (!lplogfont) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4488 return FALSE; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4489 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4490 if (lplogfont->lfHeight) |
13434 | 4491 { |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4492 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4493 sprintf (height_dpi, "%u", |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4494 (abs (lplogfont->lfHeight) * 720) / one_w32_display_info.height_in); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4495 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4496 else |
13434 | 4497 { |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4498 strcpy (height_pixels, "*"); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4499 strcpy (height_dpi, "*"); |
13434 | 4500 } |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4501 if (lplogfont->lfWidth) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4502 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4503 else |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4504 strcpy (width_pixels, "*"); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4505 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4506 _snprintf (lpxstr, len - 1, |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4507 "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-*-%s-", |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4508 lplogfont->lfFaceName, |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4509 w32_to_x_weight (lplogfont->lfWeight), |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4510 lplogfont->lfItalic?'i':'r', |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4511 height_pixels, |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4512 height_dpi, |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4513 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c', |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4514 width_pixels, |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4515 w32_to_x_charset (lplogfont->lfCharSet) |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4516 ); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4517 |
13434 | 4518 lpxstr[len - 1] = 0; /* just to be sure */ |
4519 return (TRUE); | |
4520 } | |
4521 | |
4522 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4523 x_to_w32_font (lpxstr, lplogfont) |
13434 | 4524 char * lpxstr; |
4525 LOGFONT * lplogfont; | |
4526 { | |
4527 if (!lplogfont) return (FALSE); | |
4528 | |
4529 memset (lplogfont, 0, sizeof (*lplogfont)); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4530 |
15380
8b01836a6b06
(x_to_win32_font): Allow any quality fonts.
Richard M. Stallman <rms@gnu.org>
parents:
15377
diff
changeset
|
4531 #if 1 |
13434 | 4532 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS; |
4533 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; | |
4534 lplogfont->lfQuality = DEFAULT_QUALITY; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4535 #else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4536 /* go for maximum quality */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4537 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4538 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4539 lplogfont->lfQuality = PROOF_QUALITY; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4540 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4541 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4542 if (!lpxstr) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4543 return FALSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4544 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4545 /* Provide a simple escape mechanism for specifying Windows font names |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4546 * directly -- if font spec does not beginning with '-', assume this |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4547 * format: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4548 * "<font name>[:height in pixels[:width in pixels[:weight]]]" |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4549 */ |
13434 | 4550 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4551 if (*lpxstr == '-') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4552 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4553 int fields; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4554 char name[50], weight[20], slant, pitch, pixels[10], height[10], width[10], remainder[20]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4555 char * encoding; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4556 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4557 fields = sscanf (lpxstr, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4558 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%*[^-]-%c-%9[^-]-%19s", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4559 name, weight, &slant, pixels, height, &pitch, width, remainder); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4560 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4561 if (fields == EOF) return (FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4562 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4563 if (fields > 0 && name[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4564 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4565 strncpy (lplogfont->lfFaceName,name, LF_FACESIZE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4566 lplogfont->lfFaceName[LF_FACESIZE-1] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4567 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4568 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4569 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4570 lplogfont->lfFaceName[0] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4571 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4572 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4573 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4574 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4575 lplogfont->lfWeight = x_to_w32_weight ((fields > 0 ? weight : "")); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4576 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4577 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4578 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4579 if (!NILP (Vw32_enable_italics)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4580 lplogfont->lfItalic = (fields > 0 && slant == 'i'); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4581 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4582 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4583 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4584 if (fields > 0 && pixels[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4585 lplogfont->lfHeight = atoi (pixels); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4586 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4587 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4588 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4589 if (fields > 0 && lplogfont->lfHeight == 0 && height[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4590 lplogfont->lfHeight = (atoi (height) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4591 * one_w32_display_info.height_in) / 720; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4592 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4593 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4594 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4595 lplogfont->lfPitchAndFamily = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4596 (fields > 0 && pitch == 'p') ? VARIABLE_PITCH : FIXED_PITCH; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4597 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4598 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4599 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4600 if (fields > 0 && width[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4601 lplogfont->lfWidth = atoi (width) / 10; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4602 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4603 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4604 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4605 /* Not all font specs include the registry field, so we allow for an |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4606 optional registry field before the encoding when parsing |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4607 remainder. Also we strip the trailing '-' if present. */ |
14353 | 4608 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4609 int len = strlen (remainder); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4610 if (len > 0 && remainder[len-1] == '-') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4611 remainder[len-1] = 0; |
13434 | 4612 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4613 encoding = remainder; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4614 if (strncmp (encoding, "*-", 2) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4615 encoding += 2; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4616 lplogfont->lfCharSet = x_to_w32_charset (fields > 0 ? encoding : ""); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4617 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4618 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4619 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4620 int fields; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4621 char name[100], height[10], width[10], weight[20]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4622 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4623 fields = sscanf (lpxstr, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4624 "%99[^:]:%9[^:]:%9[^:]:%19s", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4625 name, height, width, weight); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4626 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4627 if (fields == EOF) return (FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4628 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4629 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4630 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4631 strncpy (lplogfont->lfFaceName,name, LF_FACESIZE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4632 lplogfont->lfFaceName[LF_FACESIZE-1] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4633 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4634 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4635 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4636 lplogfont->lfFaceName[0] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4637 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4638 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4639 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4640 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4641 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4642 lplogfont->lfHeight = atoi (height); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4643 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4644 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4645 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4646 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4647 lplogfont->lfWidth = atoi (width); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4648 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4649 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4650 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4651 lplogfont->lfWeight = x_to_w32_weight ((fields > 0 ? weight : "")); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4652 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4653 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4654 /* This makes TrueType fonts work better. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4655 lplogfont->lfHeight = - abs (lplogfont->lfHeight); |
13434 | 4656 |
4657 return (TRUE); | |
4658 } | |
4659 | |
4660 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4661 w32_font_match (lpszfont1, lpszfont2) |
13434 | 4662 char * lpszfont1; |
4663 char * lpszfont2; | |
4664 { | |
4665 char * s1 = lpszfont1, *e1; | |
4666 char * s2 = lpszfont2, *e2; | |
4667 | |
4668 if (s1 == NULL || s2 == NULL) return (FALSE); | |
4669 | |
4670 if (*s1 == '-') s1++; | |
4671 if (*s2 == '-') s2++; | |
4672 | |
4673 while (1) | |
4674 { | |
4675 int len1, len2; | |
4676 | |
4677 e1 = strchr (s1, '-'); | |
4678 e2 = strchr (s2, '-'); | |
4679 | |
4680 if (e1 == NULL || e2 == NULL) return (TRUE); | |
4681 | |
4682 len1 = e1 - s1; | |
4683 len2 = e2 - s2; | |
4684 | |
4685 if (*s1 != '*' && *s2 != '*' | |
4686 && (len1 != len2 || strnicmp (s1, s2, len1) != 0)) | |
4687 return (FALSE); | |
4688 | |
4689 s1 = e1 + 1; | |
4690 s2 = e2 + 1; | |
4691 } | |
4692 } | |
4693 | |
4694 typedef struct enumfont_t | |
4695 { | |
4696 HDC hdc; | |
4697 int numFonts; | |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4698 LOGFONT logfont; |
13434 | 4699 XFontStruct *size_ref; |
4700 Lisp_Object *pattern; | |
4701 Lisp_Object *head; | |
4702 Lisp_Object *tail; | |
4703 } enumfont_t; | |
4704 | |
4705 int CALLBACK | |
4706 enum_font_cb2 (lplf, lptm, FontType, lpef) | |
4707 ENUMLOGFONT * lplf; | |
4708 NEWTEXTMETRIC * lptm; | |
4709 int FontType; | |
4710 enumfont_t * lpef; | |
4711 { | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4712 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline) |
13434 | 4713 return (1); |
4714 | |
4715 /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */ | |
4716 { | |
4717 char buf[100]; | |
4718 | |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4719 if (!NILP (*(lpef->pattern)) && FontType == TRUETYPE_FONTTYPE) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4720 { |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4721 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4722 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4723 } |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4724 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4725 if (!w32_to_x_font (lplf, buf, 100)) return (0); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4726 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4727 if (NILP (*(lpef->pattern)) || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) |
13434 | 4728 { |
4729 *lpef->tail = Fcons (build_string (buf), Qnil); | |
4730 lpef->tail = &XCONS (*lpef->tail)->cdr; | |
4731 lpef->numFonts++; | |
4732 } | |
4733 } | |
4734 | |
4735 return (1); | |
4736 } | |
4737 | |
4738 int CALLBACK | |
4739 enum_font_cb1 (lplf, lptm, FontType, lpef) | |
4740 ENUMLOGFONT * lplf; | |
4741 NEWTEXTMETRIC * lptm; | |
4742 int FontType; | |
4743 enumfont_t * lpef; | |
4744 { | |
4745 return EnumFontFamilies (lpef->hdc, | |
4746 lplf->elfLogFont.lfFaceName, | |
4747 (FONTENUMPROC) enum_font_cb2, | |
4748 (LPARAM) lpef); | |
4749 } | |
4750 | |
4751 | |
4752 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 3, 0, | |
4753 "Return a list of the names of available fonts matching PATTERN.\n\ | |
4754 If optional arguments FACE and FRAME are specified, return only fonts\n\ | |
4755 the same size as FACE on FRAME.\n\ | |
4756 \n\ | |
4757 PATTERN is a string, perhaps with wildcard characters;\n\ | |
4758 the * character matches any substring, and\n\ | |
4759 the ? character matches any single character.\n\ | |
4760 PATTERN is case-insensitive.\n\ | |
4761 FACE is a face name--a symbol.\n\ | |
4762 \n\ | |
4763 The return value is a list of strings, suitable as arguments to\n\ | |
4764 set-face-font.\n\ | |
4765 \n\ | |
4766 Fonts Emacs can't use (i.e. proportional fonts) may or may not be excluded\n\ | |
4767 even if they match PATTERN and FACE.") | |
4768 (pattern, face, frame) | |
4769 Lisp_Object pattern, face, frame; | |
4770 { | |
4771 int num_fonts; | |
4772 char **names; | |
4773 XFontStruct *info; | |
4774 XFontStruct *size_ref; | |
4775 Lisp_Object namelist; | |
4776 Lisp_Object list; | |
4777 FRAME_PTR f; | |
4778 enumfont_t ef; | |
4779 | |
4780 CHECK_STRING (pattern, 0); | |
4781 if (!NILP (face)) | |
4782 CHECK_SYMBOL (face, 1); | |
4783 | |
4784 f = check_x_frame (frame); | |
4785 | |
4786 /* Determine the width standard for comparison with the fonts we find. */ | |
4787 | |
4788 if (NILP (face)) | |
4789 size_ref = 0; | |
4790 else | |
4791 { | |
4792 int face_id; | |
4793 | |
4794 /* Don't die if we get called with a terminal frame. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4795 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4796 error ("non-w32 frame used in `x-list-fonts'"); |
13434 | 4797 |
4798 face_id = face_name_id_number (f, face); | |
4799 | |
4800 if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f) | |
4801 || FRAME_PARAM_FACES (f) [face_id] == 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4802 size_ref = f->output_data.w32->font; |
13434 | 4803 else |
4804 { | |
4805 size_ref = FRAME_PARAM_FACES (f) [face_id]->font; | |
4806 if (size_ref == (XFontStruct *) (~0)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4807 size_ref = f->output_data.w32->font; |
13434 | 4808 } |
4809 } | |
4810 | |
4811 /* See if we cached the result for this particular query. */ | |
4812 list = Fassoc (pattern, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4813 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr); |
13434 | 4814 |
4815 /* We have info in the cache for this PATTERN. */ | |
4816 if (!NILP (list)) | |
4817 { | |
4818 Lisp_Object tem, newlist; | |
4819 | |
4820 /* We have info about this pattern. */ | |
4821 list = XCONS (list)->cdr; | |
4822 | |
4823 if (size_ref == 0) | |
4824 return list; | |
4825 | |
4826 BLOCK_INPUT; | |
4827 | |
4828 /* Filter the cached info and return just the fonts that match FACE. */ | |
4829 newlist = Qnil; | |
4830 for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr) | |
4831 { | |
4832 XFontStruct *thisinfo; | |
4833 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4834 thisinfo = w32_load_font (FRAME_W32_DISPLAY_INFO (f), XSTRING (XCONS (tem)->car)->data); |
13434 | 4835 |
4836 if (thisinfo && same_size_fonts (thisinfo, size_ref)) | |
4837 newlist = Fcons (XCONS (tem)->car, newlist); | |
4838 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4839 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo); |
13434 | 4840 } |
4841 | |
4842 UNBLOCK_INPUT; | |
4843 | |
4844 return newlist; | |
4845 } | |
4846 | |
4847 BLOCK_INPUT; | |
4848 | |
4849 namelist = Qnil; | |
4850 ef.pattern = &pattern; | |
4851 ef.tail = ef.head = &namelist; | |
4852 ef.numFonts = 0; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4853 x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont); |
13434 | 4854 |
4855 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4856 ef.hdc = GetDC (FRAME_W32_WINDOW (f)); |
13434 | 4857 |
4858 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, (LPARAM)&ef); | |
4859 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4860 ReleaseDC (FRAME_W32_WINDOW (f), ef.hdc); |
13434 | 4861 } |
4862 | |
4863 UNBLOCK_INPUT; | |
4864 | |
4865 if (ef.numFonts) | |
4866 { | |
4867 int i; | |
4868 Lisp_Object cur; | |
4869 | |
4870 /* Make a list of all the fonts we got back. | |
4871 Store that in the font cache for the display. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4872 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr |
13434 | 4873 = Fcons (Fcons (pattern, namelist), |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4874 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr); |
13434 | 4875 |
4876 /* Make a list of the fonts that have the right width. */ | |
4877 list = Qnil; | |
4878 cur=namelist; | |
4879 for (i = 0; i < ef.numFonts; i++) | |
4880 { | |
4881 int keeper; | |
4882 | |
4883 if (!size_ref) | |
4884 keeper = 1; | |
4885 else | |
4886 { | |
4887 XFontStruct *thisinfo; | |
4888 | |
4889 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4890 thisinfo = w32_load_font (FRAME_W32_DISPLAY_INFO (f), XSTRING (Fcar (cur))->data); |
13434 | 4891 |
4892 keeper = thisinfo && same_size_fonts (thisinfo, size_ref); | |
4893 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4894 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo); |
13434 | 4895 |
4896 UNBLOCK_INPUT; | |
4897 } | |
4898 if (keeper) | |
4899 list = Fcons (build_string (XSTRING (Fcar (cur))->data), list); | |
4900 | |
4901 cur = Fcdr (cur); | |
4902 } | |
4903 list = Fnreverse (list); | |
4904 } | |
4905 | |
4906 return list; | |
4907 } | |
4908 | |
4909 DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, | |
4910 "Return non-nil if color COLOR is supported on frame FRAME.\n\ | |
4911 If FRAME is omitted or nil, use the selected frame.") | |
4912 (color, frame) | |
4913 Lisp_Object color, frame; | |
4914 { | |
4915 COLORREF foo; | |
4916 FRAME_PTR f = check_x_frame (frame); | |
4917 | |
4918 CHECK_STRING (color, 1); | |
4919 | |
4920 if (defined_color (f, XSTRING (color)->data, &foo, 0)) | |
4921 return Qt; | |
4922 else | |
4923 return Qnil; | |
4924 } | |
4925 | |
4926 DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0, | |
4927 "Return a description of the color named COLOR on frame FRAME.\n\ | |
4928 The value is a list of integer RGB values--(RED GREEN BLUE).\n\ | |
4929 These values appear to range from 0 to 65280 or 65535, depending\n\ | |
4930 on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\ | |
4931 If FRAME is omitted or nil, use the selected frame.") | |
4932 (color, frame) | |
4933 Lisp_Object color, frame; | |
4934 { | |
4935 COLORREF foo; | |
4936 FRAME_PTR f = check_x_frame (frame); | |
4937 | |
4938 CHECK_STRING (color, 1); | |
4939 | |
4940 if (defined_color (f, XSTRING (color)->data, &foo, 0)) | |
4941 { | |
4942 Lisp_Object rgb[3]; | |
4943 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4944 rgb[0] = make_number ((GetRValue (foo) << 8) | GetRValue (foo)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4945 rgb[1] = make_number ((GetGValue (foo) << 8) | GetGValue (foo)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4946 rgb[2] = make_number ((GetBValue (foo) << 8) | GetBValue (foo)); |
13434 | 4947 return Flist (3, rgb); |
4948 } | |
4949 else | |
4950 return Qnil; | |
4951 } | |
4952 | |
4953 DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0, | |
4954 "Return t if the X display supports color.\n\ | |
4955 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4956 DISPLAY should be either a frame or a display name (a string).\n\ | |
4957 If omitted or nil, that stands for the selected frame's display.") | |
4958 (display) | |
4959 Lisp_Object display; | |
4960 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4961 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 4962 |
4963 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2) | |
4964 return Qnil; | |
4965 | |
4966 return Qt; | |
4967 } | |
4968 | |
4969 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, | |
4970 0, 1, 0, | |
4971 "Return t if the X display supports shades of gray.\n\ | |
4972 Note that color displays do support shades of gray.\n\ | |
4973 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4974 DISPLAY should be either a frame or a display name (a string).\n\ | |
4975 If omitted or nil, that stands for the selected frame's display.") | |
4976 (display) | |
4977 Lisp_Object display; | |
4978 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4979 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 4980 |
4981 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1) | |
4982 return Qnil; | |
4983 | |
4984 return Qt; | |
4985 } | |
4986 | |
4987 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, | |
4988 0, 1, 0, | |
4989 "Returns the width in pixels of the X display DISPLAY.\n\ | |
4990 The optional argument DISPLAY specifies which display to ask about.\n\ | |
4991 DISPLAY should be either a frame or a display name (a string).\n\ | |
4992 If omitted or nil, that stands for the selected frame's display.") | |
4993 (display) | |
4994 Lisp_Object display; | |
4995 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4996 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 4997 |
4998 return make_number (dpyinfo->width); | |
4999 } | |
5000 | |
5001 DEFUN ("x-display-pixel-height", Fx_display_pixel_height, | |
5002 Sx_display_pixel_height, 0, 1, 0, | |
5003 "Returns the height in pixels of the X display DISPLAY.\n\ | |
5004 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5005 DISPLAY should be either a frame or a display name (a string).\n\ | |
5006 If omitted or nil, that stands for the selected frame's display.") | |
5007 (display) | |
5008 Lisp_Object display; | |
5009 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5010 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5011 |
5012 return make_number (dpyinfo->height); | |
5013 } | |
5014 | |
5015 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, | |
5016 0, 1, 0, | |
5017 "Returns the number of bitplanes of the display DISPLAY.\n\ | |
5018 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5019 DISPLAY should be either a frame or a display name (a string).\n\ | |
5020 If omitted or nil, that stands for the selected frame's display.") | |
5021 (display) | |
5022 Lisp_Object display; | |
5023 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5024 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5025 |
5026 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits); | |
5027 } | |
5028 | |
5029 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, | |
5030 0, 1, 0, | |
5031 "Returns the number of color cells of the display DISPLAY.\n\ | |
5032 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5033 DISPLAY should be either a frame or a display name (a string).\n\ | |
5034 If omitted or nil, that stands for the selected frame's display.") | |
5035 (display) | |
5036 Lisp_Object display; | |
5037 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5038 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5039 HDC hdc; |
5040 int cap; | |
5041 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5042 hdc = GetDC (dpyinfo->root_window); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5043 if (dpyinfo->has_palette) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5044 cap = GetDeviceCaps (hdc,SIZEPALETTE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5045 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5046 cap = GetDeviceCaps (hdc,NUMCOLORS); |
13434 | 5047 |
5048 ReleaseDC (dpyinfo->root_window, hdc); | |
5049 | |
5050 return make_number (cap); | |
5051 } | |
5052 | |
5053 DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |
5054 Sx_server_max_request_size, | |
5055 0, 1, 0, | |
5056 "Returns the maximum request size of the server of display DISPLAY.\n\ | |
5057 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5058 DISPLAY should be either a frame or a display name (a string).\n\ | |
5059 If omitted or nil, that stands for the selected frame's display.") | |
5060 (display) | |
5061 Lisp_Object display; | |
5062 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5063 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5064 |
5065 return make_number (1); | |
5066 } | |
5067 | |
5068 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5069 "Returns the vendor ID string of the W32 system (Microsoft).\n\ |
13434 | 5070 The optional argument DISPLAY specifies which display to ask about.\n\ |
5071 DISPLAY should be either a frame or a display name (a string).\n\ | |
5072 If omitted or nil, that stands for the selected frame's display.") | |
5073 (display) | |
5074 Lisp_Object display; | |
5075 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5076 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5077 char *vendor = "Microsoft Corp."; |
5078 | |
5079 if (! vendor) vendor = ""; | |
5080 return build_string (vendor); | |
5081 } | |
5082 | |
5083 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, | |
5084 "Returns the version numbers of the server of display DISPLAY.\n\ | |
5085 The value is a list of three integers: the major and minor\n\ | |
5086 version numbers, and the vendor-specific release\n\ | |
5087 number. See also the function `x-server-vendor'.\n\n\ | |
5088 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5089 DISPLAY should be either a frame or a display name (a string).\n\ | |
5090 If omitted or nil, that stands for the selected frame's display.") | |
5091 (display) | |
5092 Lisp_Object display; | |
5093 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5094 struct w32_display_info *dpyinfo = check_x_display_info (display); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5095 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5096 return Fcons (make_number (w32_major_version), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5097 Fcons (make_number (w32_minor_version), Qnil)); |
13434 | 5098 } |
5099 | |
5100 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, | |
5101 "Returns the number of screens on the server of display DISPLAY.\n\ | |
5102 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5103 DISPLAY should be either a frame or a display name (a string).\n\ | |
5104 If omitted or nil, that stands for the selected frame's display.") | |
5105 (display) | |
5106 Lisp_Object display; | |
5107 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5108 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5109 |
5110 return make_number (1); | |
5111 } | |
5112 | |
5113 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0, | |
5114 "Returns the height in millimeters of the X display DISPLAY.\n\ | |
5115 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5116 DISPLAY should be either a frame or a display name (a string).\n\ | |
5117 If omitted or nil, that stands for the selected frame's display.") | |
5118 (display) | |
5119 Lisp_Object display; | |
5120 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5121 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5122 HDC hdc; |
5123 int cap; | |
5124 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5125 hdc = GetDC (dpyinfo->root_window); |
14353 | 5126 |
13434 | 5127 cap = GetDeviceCaps (hdc, VERTSIZE); |
14353 | 5128 |
13434 | 5129 ReleaseDC (dpyinfo->root_window, hdc); |
5130 | |
5131 return make_number (cap); | |
5132 } | |
5133 | |
5134 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, | |
5135 "Returns the width in millimeters of the X display DISPLAY.\n\ | |
5136 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5137 DISPLAY should be either a frame or a display name (a string).\n\ | |
5138 If omitted or nil, that stands for the selected frame's display.") | |
5139 (display) | |
5140 Lisp_Object display; | |
5141 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5142 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5143 |
5144 HDC hdc; | |
5145 int cap; | |
5146 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5147 hdc = GetDC (dpyinfo->root_window); |
14353 | 5148 |
13434 | 5149 cap = GetDeviceCaps (hdc, HORZSIZE); |
14353 | 5150 |
13434 | 5151 ReleaseDC (dpyinfo->root_window, hdc); |
5152 | |
5153 return make_number (cap); | |
5154 } | |
5155 | |
5156 DEFUN ("x-display-backing-store", Fx_display_backing_store, | |
5157 Sx_display_backing_store, 0, 1, 0, | |
5158 "Returns an indication of whether display DISPLAY does backing store.\n\ | |
5159 The value may be `always', `when-mapped', or `not-useful'.\n\ | |
5160 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5161 DISPLAY should be either a frame or a display name (a string).\n\ | |
5162 If omitted or nil, that stands for the selected frame's display.") | |
5163 (display) | |
5164 Lisp_Object display; | |
5165 { | |
5166 return intern ("not-useful"); | |
5167 } | |
5168 | |
5169 DEFUN ("x-display-visual-class", Fx_display_visual_class, | |
5170 Sx_display_visual_class, 0, 1, 0, | |
5171 "Returns the visual class of the display DISPLAY.\n\ | |
5172 The value is one of the symbols `static-gray', `gray-scale',\n\ | |
5173 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\ | |
5174 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5175 DISPLAY should be either a frame or a display name (a string).\n\ | |
5176 If omitted or nil, that stands for the selected frame's display.") | |
5177 (display) | |
5178 Lisp_Object display; | |
5179 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5180 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5181 |
5182 #if 0 | |
5183 switch (dpyinfo->visual->class) | |
5184 { | |
5185 case StaticGray: return (intern ("static-gray")); | |
5186 case GrayScale: return (intern ("gray-scale")); | |
5187 case StaticColor: return (intern ("static-color")); | |
5188 case PseudoColor: return (intern ("pseudo-color")); | |
5189 case TrueColor: return (intern ("true-color")); | |
5190 case DirectColor: return (intern ("direct-color")); | |
5191 default: | |
5192 error ("Display has an unknown visual class"); | |
5193 } | |
5194 #endif | |
5195 | |
5196 error ("Display has an unknown visual class"); | |
5197 } | |
5198 | |
5199 DEFUN ("x-display-save-under", Fx_display_save_under, | |
5200 Sx_display_save_under, 0, 1, 0, | |
5201 "Returns t if the display DISPLAY supports the save-under feature.\n\ | |
5202 The optional argument DISPLAY specifies which display to ask about.\n\ | |
5203 DISPLAY should be either a frame or a display name (a string).\n\ | |
5204 If omitted or nil, that stands for the selected frame's display.") | |
5205 (display) | |
5206 Lisp_Object display; | |
5207 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5208 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5209 |
5210 return Qnil; | |
5211 } | |
5212 | |
5213 int | |
5214 x_pixel_width (f) | |
5215 register struct frame *f; | |
5216 { | |
5217 return PIXEL_WIDTH (f); | |
5218 } | |
5219 | |
5220 int | |
5221 x_pixel_height (f) | |
5222 register struct frame *f; | |
5223 { | |
5224 return PIXEL_HEIGHT (f); | |
5225 } | |
5226 | |
5227 int | |
5228 x_char_width (f) | |
5229 register struct frame *f; | |
5230 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5231 return FONT_WIDTH (f->output_data.w32->font); |
13434 | 5232 } |
5233 | |
5234 int | |
5235 x_char_height (f) | |
5236 register struct frame *f; | |
5237 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5238 return f->output_data.w32->line_height; |
13434 | 5239 } |
5240 | |
5241 int | |
5242 x_screen_planes (frame) | |
5243 Lisp_Object frame; | |
5244 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5245 return (FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_planes * |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5246 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits); |
13434 | 5247 } |
5248 | |
5249 /* Return the display structure for the display named NAME. | |
5250 Open a new connection if necessary. */ | |
5251 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5252 struct w32_display_info * |
13434 | 5253 x_display_info_for_name (name) |
5254 Lisp_Object name; | |
5255 { | |
5256 Lisp_Object names; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5257 struct w32_display_info *dpyinfo; |
13434 | 5258 |
5259 CHECK_STRING (name, 0); | |
5260 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5261 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list; |
13434 | 5262 dpyinfo; |
5263 dpyinfo = dpyinfo->next, names = XCONS (names)->cdr) | |
5264 { | |
5265 Lisp_Object tem; | |
5266 tem = Fstring_equal (XCONS (XCONS (names)->car)->car, name); | |
5267 if (!NILP (tem)) | |
5268 return dpyinfo; | |
5269 } | |
5270 | |
5271 /* Use this general default value to start with. */ | |
5272 Vx_resource_name = Vinvocation_name; | |
5273 | |
5274 validate_x_resource_name (); | |
5275 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5276 dpyinfo = w32_term_init (name, (unsigned char *)0, |
13434 | 5277 (char *) XSTRING (Vx_resource_name)->data); |
5278 | |
5279 if (dpyinfo == 0) | |
5280 error ("Cannot connect to server %s", XSTRING (name)->data); | |
5281 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5282 w32_in_use = 1; |
13434 | 5283 XSETFASTINT (Vwindow_system_version, 3); |
5284 | |
5285 return dpyinfo; | |
5286 } | |
5287 | |
5288 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, | |
5289 1, 3, 0, "Open a connection to a server.\n\ | |
5290 DISPLAY is the name of the display to connect to.\n\ | |
5291 Optional second arg XRM-STRING is a string of resources in xrdb format.\n\ | |
5292 If the optional third arg MUST-SUCCEED is non-nil,\n\ | |
5293 terminate Emacs if we can't open the connection.") | |
5294 (display, xrm_string, must_succeed) | |
5295 Lisp_Object display, xrm_string, must_succeed; | |
5296 { | |
5297 unsigned int n_planes; | |
5298 unsigned char *xrm_option; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5299 struct w32_display_info *dpyinfo; |
13434 | 5300 |
5301 CHECK_STRING (display, 0); | |
5302 if (! NILP (xrm_string)) | |
5303 CHECK_STRING (xrm_string, 1); | |
5304 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5305 if (! EQ (Vwindow_system, intern ("w32"))) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5306 error ("Not using Microsoft Windows"); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5307 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5308 /* Allow color mapping to be defined externally; first look in user's |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5309 HOME directory, then in Emacs etc dir for a file called rgb.txt. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5310 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5311 Lisp_Object color_file; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5312 struct gcpro gcpro1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5313 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5314 color_file = build_string("~/rgb.txt"); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5315 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5316 GCPRO1 (color_file); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5317 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5318 if (NILP (Ffile_readable_p (color_file))) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5319 color_file = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5320 Fexpand_file_name (build_string ("rgb.txt"), |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5321 Fsymbol_value (intern ("data-directory"))); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5322 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5323 Vw32_color_map = Fw32_load_color_file (color_file); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5324 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5325 UNGCPRO; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5326 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5327 if (NILP (Vw32_color_map)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5328 Vw32_color_map = Fw32_default_color_map (); |
13434 | 5329 |
5330 if (! NILP (xrm_string)) | |
5331 xrm_option = (unsigned char *) XSTRING (xrm_string)->data; | |
5332 else | |
5333 xrm_option = (unsigned char *) 0; | |
5334 | |
5335 /* Use this general default value to start with. */ | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5336 /* First remove .exe suffix from invocation-name - it looks ugly. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5337 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5338 char basename[ MAX_PATH ], *str; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5339 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5340 strcpy (basename, XSTRING (Vinvocation_name)->data); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5341 str = strrchr (basename, '.'); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5342 if (str) *str = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5343 Vinvocation_name = build_string (basename); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5344 } |
13434 | 5345 Vx_resource_name = Vinvocation_name; |
5346 | |
5347 validate_x_resource_name (); | |
5348 | |
5349 /* This is what opens the connection and sets x_current_display. | |
5350 This also initializes many symbols, such as those used for input. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5351 dpyinfo = w32_term_init (display, xrm_option, |
13434 | 5352 (char *) XSTRING (Vx_resource_name)->data); |
5353 | |
5354 if (dpyinfo == 0) | |
5355 { | |
5356 if (!NILP (must_succeed)) | |
14353 | 5357 fatal ("Cannot connect to server %s.\n", |
5358 XSTRING (display)->data); | |
13434 | 5359 else |
5360 error ("Cannot connect to server %s", XSTRING (display)->data); | |
5361 } | |
5362 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5363 w32_in_use = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5364 |
13434 | 5365 XSETFASTINT (Vwindow_system_version, 3); |
5366 return Qnil; | |
5367 } | |
5368 | |
5369 DEFUN ("x-close-connection", Fx_close_connection, | |
5370 Sx_close_connection, 1, 1, 0, | |
5371 "Close the connection to DISPLAY's server.\n\ | |
5372 For DISPLAY, specify either a frame or a display name (a string).\n\ | |
5373 If DISPLAY is nil, that stands for the selected frame's display.") | |
5374 (display) | |
5375 Lisp_Object display; | |
5376 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5377 struct w32_display_info *dpyinfo = check_x_display_info (display); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5378 struct w32_display_info *tail; |
13434 | 5379 int i; |
5380 | |
5381 if (dpyinfo->reference_count > 0) | |
5382 error ("Display still has frames on it"); | |
5383 | |
5384 BLOCK_INPUT; | |
5385 /* Free the fonts in the font table. */ | |
5386 for (i = 0; i < dpyinfo->n_fonts; i++) | |
5387 { | |
5388 if (dpyinfo->font_table[i].name) | |
5389 free (dpyinfo->font_table[i].name); | |
5390 /* Don't free the full_name string; | |
5391 it is always shared with something else. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5392 w32_unload_font (dpyinfo, dpyinfo->font_table[i].font); |
13434 | 5393 } |
5394 x_destroy_all_bitmaps (dpyinfo); | |
5395 | |
5396 x_delete_display (dpyinfo); | |
5397 UNBLOCK_INPUT; | |
5398 | |
5399 return Qnil; | |
5400 } | |
5401 | |
5402 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, | |
5403 "Return the list of display names that Emacs has connections to.") | |
5404 () | |
5405 { | |
5406 Lisp_Object tail, result; | |
5407 | |
5408 result = Qnil; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5409 for (tail = w32_display_name_list; ! NILP (tail); tail = XCONS (tail)->cdr) |
13434 | 5410 result = Fcons (XCONS (XCONS (tail)->car)->car, result); |
5411 | |
5412 return result; | |
5413 } | |
5414 | |
5415 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, | |
5416 "If ON is non-nil, report errors as soon as the erring request is made.\n\ | |
5417 If ON is nil, allow buffering of requests.\n\ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5418 This is a noop on W32 systems.\n\ |
13434 | 5419 The optional second argument DISPLAY specifies which display to act on.\n\ |
5420 DISPLAY should be either a frame or a display name (a string).\n\ | |
5421 If DISPLAY is omitted or nil, that stands for the selected frame's display.") | |
5422 (on, display) | |
5423 Lisp_Object display, on; | |
5424 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5425 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 5426 |
5427 return Qnil; | |
5428 } | |
5429 | |
5430 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5431 /* These are the w32 specialized functions */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5432 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5433 DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 1, 0, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5434 "This will display the W32 font dialog and return an X font string corresponding to the selection.") |
13434 | 5435 (frame) |
5436 Lisp_Object frame; | |
5437 { | |
5438 FRAME_PTR f = check_x_frame (frame); | |
5439 CHOOSEFONT cf; | |
5440 LOGFONT lf; | |
5441 char buf[100]; | |
5442 | |
5443 bzero (&cf, sizeof (cf)); | |
5444 | |
5445 cf.lStructSize = sizeof (cf); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5446 cf.hwndOwner = FRAME_W32_WINDOW (f); |
13434 | 5447 cf.Flags = CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_SCREENFONTS; |
5448 cf.lpLogFont = &lf; | |
5449 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5450 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100)) |
14353 | 5451 return Qnil; |
13434 | 5452 |
5453 return build_string (buf); | |
5454 } | |
5455 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5456 DEFUN ("w32-send-sys-command", Fw32_send_sys_command, Sw32_send_sys_command, 1, 2, 0, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5457 "Send frame a Windows WM_SYSCOMMAND message of type COMMAND.\n\ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5458 Some useful values for command are 0xf030 to maximise frame (0xf020\n\ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5459 to minimize), 0xf120 to restore frame to original size, and 0xf100\n\ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5460 to activate the menubar for keyboard access. 0xf140 activates the\n\ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5461 screen saver if defined.\n\ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5462 \n\ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5463 If optional parameter FRAME is not specified, use selected frame.") |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5464 (command, frame) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5465 Lisp_Object command, frame; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5466 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5467 WPARAM code; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5468 FRAME_PTR f = check_x_frame (frame); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5469 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5470 CHECK_NUMBER (command, 0); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5471 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5472 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XINT (command), 0); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5473 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5474 return Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5475 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5476 |
13434 | 5477 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5478 syms_of_w32fns () |
13434 | 5479 { |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5480 /* This is zero if not using MS-Windows. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5481 w32_in_use = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5482 |
13434 | 5483 /* The section below is built by the lisp expression at the top of the file, |
5484 just above where these variables are declared. */ | |
5485 /*&&& init symbols here &&&*/ | |
5486 Qauto_raise = intern ("auto-raise"); | |
5487 staticpro (&Qauto_raise); | |
5488 Qauto_lower = intern ("auto-lower"); | |
5489 staticpro (&Qauto_lower); | |
5490 Qbackground_color = intern ("background-color"); | |
5491 staticpro (&Qbackground_color); | |
5492 Qbar = intern ("bar"); | |
5493 staticpro (&Qbar); | |
5494 Qborder_color = intern ("border-color"); | |
5495 staticpro (&Qborder_color); | |
5496 Qborder_width = intern ("border-width"); | |
5497 staticpro (&Qborder_width); | |
5498 Qbox = intern ("box"); | |
5499 staticpro (&Qbox); | |
5500 Qcursor_color = intern ("cursor-color"); | |
5501 staticpro (&Qcursor_color); | |
5502 Qcursor_type = intern ("cursor-type"); | |
5503 staticpro (&Qcursor_type); | |
5504 Qforeground_color = intern ("foreground-color"); | |
5505 staticpro (&Qforeground_color); | |
5506 Qgeometry = intern ("geometry"); | |
5507 staticpro (&Qgeometry); | |
5508 Qicon_left = intern ("icon-left"); | |
5509 staticpro (&Qicon_left); | |
5510 Qicon_top = intern ("icon-top"); | |
5511 staticpro (&Qicon_top); | |
5512 Qicon_type = intern ("icon-type"); | |
5513 staticpro (&Qicon_type); | |
5514 Qicon_name = intern ("icon-name"); | |
5515 staticpro (&Qicon_name); | |
5516 Qinternal_border_width = intern ("internal-border-width"); | |
5517 staticpro (&Qinternal_border_width); | |
5518 Qleft = intern ("left"); | |
5519 staticpro (&Qleft); | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
5520 Qright = intern ("right"); |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
5521 staticpro (&Qright); |
13434 | 5522 Qmouse_color = intern ("mouse-color"); |
5523 staticpro (&Qmouse_color); | |
5524 Qnone = intern ("none"); | |
5525 staticpro (&Qnone); | |
5526 Qparent_id = intern ("parent-id"); | |
5527 staticpro (&Qparent_id); | |
5528 Qscroll_bar_width = intern ("scroll-bar-width"); | |
5529 staticpro (&Qscroll_bar_width); | |
5530 Qsuppress_icon = intern ("suppress-icon"); | |
5531 staticpro (&Qsuppress_icon); | |
5532 Qtop = intern ("top"); | |
5533 staticpro (&Qtop); | |
5534 Qundefined_color = intern ("undefined-color"); | |
5535 staticpro (&Qundefined_color); | |
5536 Qvertical_scroll_bars = intern ("vertical-scroll-bars"); | |
5537 staticpro (&Qvertical_scroll_bars); | |
5538 Qvisibility = intern ("visibility"); | |
5539 staticpro (&Qvisibility); | |
5540 Qwindow_id = intern ("window-id"); | |
5541 staticpro (&Qwindow_id); | |
5542 Qx_frame_parameter = intern ("x-frame-parameter"); | |
5543 staticpro (&Qx_frame_parameter); | |
5544 Qx_resource_name = intern ("x-resource-name"); | |
5545 staticpro (&Qx_resource_name); | |
5546 Quser_position = intern ("user-position"); | |
5547 staticpro (&Quser_position); | |
5548 Quser_size = intern ("user-size"); | |
5549 staticpro (&Quser_size); | |
5550 Qdisplay = intern ("display"); | |
5551 staticpro (&Qdisplay); | |
5552 /* This is the end of symbol initialization. */ | |
5553 | |
5554 Fput (Qundefined_color, Qerror_conditions, | |
5555 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | |
5556 Fput (Qundefined_color, Qerror_message, | |
5557 build_string ("Undefined color")); | |
5558 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5559 DEFVAR_LISP ("w32-color-map", &Vw32_color_map, |
13434 | 5560 "A array of color name mappings for windows."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5561 Vw32_color_map = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5562 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5563 DEFVAR_LISP ("w32-pass-alt-to-system", &Vw32_pass_alt_to_system, |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
5564 "Non-nil if alt key presses are passed on to Windows.\n\ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
5565 When non-nil, for example, alt pressed and released and then space will\n\ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
5566 open the System menu. When nil, Emacs silently swallows alt key events."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5567 Vw32_pass_alt_to_system = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5568 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5569 DEFVAR_LISP ("w32-alt-is-meta", &Vw32_alt_is_meta, |
15459
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
5570 "Non-nil if the alt key is to be considered the same as the meta key.\n\ |
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
5571 When nil, Emacs will translate the alt key to the Alt modifier, and not Meta."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5572 Vw32_alt_is_meta = Qt; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5573 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5574 DEFVAR_LISP ("w32-pass-optional-keys-to-system", |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5575 &Vw32_pass_optional_keys_to_system, |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
5576 "Non-nil if the 'optional' keys (left window, right window,\n\ |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
5577 and application keys) are passed on to Windows."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5578 Vw32_pass_optional_keys_to_system = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5579 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5580 DEFVAR_LISP ("w32-enable-italics", &Vw32_enable_italics, |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5581 "Non-nil enables selection of artificially italicized fonts."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5582 Vw32_enable_italics = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5583 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5584 DEFVAR_LISP ("w32-enable-palette", &Vw32_enable_palette, |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5585 "Non-nil enables Windows palette management to map colors exactly."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5586 Vw32_enable_palette = Qt; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5587 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5588 DEFVAR_INT ("w32-mouse-button-tolerance", |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5589 &Vw32_mouse_button_tolerance, |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5590 "Analogue of double click interval for faking middle mouse events.\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5591 The value is the minimum time in milliseconds that must elapse between\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5592 left/right button down events before they are considered distinct events.\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5593 If both mouse buttons are depressed within this interval, a middle mouse\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5594 button down event is generated instead."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5595 XSETINT (Vw32_mouse_button_tolerance, GetDoubleClickTime () / 2); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5596 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5597 DEFVAR_INT ("w32-mouse-move-interval", |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5598 &Vw32_mouse_move_interval, |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
5599 "Minimum interval between mouse move events.\n\ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
5600 The value is the minimum time in milliseconds that must elapse between\n\ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
5601 successive mouse move (or scroll bar drag) events before they are\n\ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
5602 reported as lisp events."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5603 XSETINT (Vw32_mouse_move_interval, 50); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
5604 |
13434 | 5605 init_x_parm_symbols (); |
5606 | |
5607 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5608 "List of directories to search for bitmap files for w32."); |
13434 | 5609 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH"); |
5610 | |
5611 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape, | |
5612 "The shape of the pointer when over text.\n\ | |
5613 Changing the value does not affect existing frames\n\ | |
5614 unless you set the mouse color."); | |
5615 Vx_pointer_shape = Qnil; | |
5616 | |
5617 DEFVAR_LISP ("x-resource-name", &Vx_resource_name, | |
5618 "The name Emacs uses to look up resources; for internal use only.\n\ | |
5619 `x-get-resource' uses this as the first component of the instance name\n\ | |
5620 when requesting resource values.\n\ | |
5621 Emacs initially sets `x-resource-name' to the name under which Emacs\n\ | |
5622 was invoked, or to the value specified with the `-name' or `-rn'\n\ | |
5623 switches, if present."); | |
5624 Vx_resource_name = Qnil; | |
5625 | |
5626 Vx_nontext_pointer_shape = Qnil; | |
5627 | |
5628 Vx_mode_pointer_shape = Qnil; | |
5629 | |
5630 DEFVAR_INT ("x-sensitive-text-pointer-shape", | |
5631 &Vx_sensitive_text_pointer_shape, | |
5632 "The shape of the pointer when over mouse-sensitive text.\n\ | |
5633 This variable takes effect when you create a new frame\n\ | |
5634 or when you set the mouse color."); | |
5635 Vx_sensitive_text_pointer_shape = Qnil; | |
5636 | |
5637 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, | |
5638 "A string indicating the foreground color of the cursor box."); | |
5639 Vx_cursor_fore_pixel = Qnil; | |
5640 | |
5641 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, | |
5642 "Non-nil if no window manager is in use.\n\ | |
5643 Emacs doesn't try to figure this out; this is always nil\n\ | |
5644 unless you set it to something else."); | |
5645 /* We don't have any way to find this out, so set it to nil | |
5646 and maybe the user would like to set it to t. */ | |
5647 Vx_no_window_manager = Qnil; | |
5648 | |
5649 defsubr (&Sx_get_resource); | |
5650 defsubr (&Sx_list_fonts); | |
5651 defsubr (&Sx_display_color_p); | |
5652 defsubr (&Sx_display_grayscale_p); | |
5653 defsubr (&Sx_color_defined_p); | |
5654 defsubr (&Sx_color_values); | |
5655 defsubr (&Sx_server_max_request_size); | |
5656 defsubr (&Sx_server_vendor); | |
5657 defsubr (&Sx_server_version); | |
5658 defsubr (&Sx_display_pixel_width); | |
5659 defsubr (&Sx_display_pixel_height); | |
5660 defsubr (&Sx_display_mm_width); | |
5661 defsubr (&Sx_display_mm_height); | |
5662 defsubr (&Sx_display_screens); | |
5663 defsubr (&Sx_display_planes); | |
5664 defsubr (&Sx_display_color_cells); | |
5665 defsubr (&Sx_display_visual_class); | |
5666 defsubr (&Sx_display_backing_store); | |
5667 defsubr (&Sx_display_save_under); | |
5668 defsubr (&Sx_parse_geometry); | |
5669 defsubr (&Sx_create_frame); | |
5670 defsubr (&Sx_open_connection); | |
5671 defsubr (&Sx_close_connection); | |
5672 defsubr (&Sx_display_list); | |
5673 defsubr (&Sx_synchronize); | |
5674 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5675 /* W32 specific functions */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5676 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5677 defsubr (&Sw32_focus_frame); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5678 defsubr (&Sw32_select_font); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5679 defsubr (&Sw32_define_rgb_color); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5680 defsubr (&Sw32_default_color_map); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5681 defsubr (&Sw32_load_color_file); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5682 defsubr (&Sw32_send_sys_command); |
13434 | 5683 } |
5684 | |
5685 #undef abort | |
5686 | |
5687 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5688 w32_abort() |
13434 | 5689 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5690 int button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5691 button = MessageBox (NULL, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5692 "A fatal error has occurred!\n\n" |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5693 "Select Abort to exit, Retry to debug, Ignore to continue", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5694 "Emacs Abort Dialog", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5695 MB_ICONEXCLAMATION | MB_TASKMODAL |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5696 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5697 switch (button) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5698 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5699 case IDRETRY: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5700 DebugBreak (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5701 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5702 case IDIGNORE: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5703 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5704 case IDABORT: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5705 default: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5706 abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5707 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5708 } |
13434 | 5709 } |
15148
220145cf7546
(continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents:
15147
diff
changeset
|
5710 |