Mercurial > emacs
annotate src/w32fns.c @ 24448:54fa245dc776
(top level): Display character 255 as 8bit as well.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 07 Mar 1999 13:27:35 +0000 |
parents | d11ac02f9d6a |
children | 3b2c3636bf0e |
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" | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
31 #include "charset.h" |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
32 #include "fontset.h" |
13434 | 33 #include "w32term.h" |
34 #include "frame.h" | |
35 #include "window.h" | |
36 #include "buffer.h" | |
37 #include "dispextern.h" | |
38 #include "keyboard.h" | |
39 #include "blockinput.h" | |
24412
d11ac02f9d6a
Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents:
24339
diff
changeset
|
40 #include "epaths.h" |
16593
4ed80eda6fac
Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
41 #include "w32heap.h" |
13434 | 42 #include "termhooks.h" |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
43 #include "coding.h" |
13434 | 44 |
45 #include <commdlg.h> | |
21884 | 46 #include <shellapi.h> |
13434 | 47 |
48 extern void abort (); | |
49 extern void free_frame_menubar (); | |
50 extern struct scroll_bar *x_window_to_scroll_bar (); | |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
51 extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
52 extern int quit_char; |
13434 | 53 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
54 extern char *lispy_function_keys[]; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
55 |
13434 | 56 /* 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
|
57 Lisp_Object Vw32_color_map; |
13434 | 58 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
59 /* 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
|
60 Lisp_Object Vw32_pass_alt_to_system; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
61 |
15459
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
62 /* 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
|
63 to alt_modifier. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
64 Lisp_Object Vw32_alt_is_meta; |
15459
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
65 |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
66 /* If non-zero, the windows virtual key code for an alternative quit key. */ |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
67 Lisp_Object Vw32_quit_key; |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
68 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
69 /* Non nil if left window key events are passed on to Windows (this only |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
70 affects whether "tapping" the key opens the Start menu). */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
71 Lisp_Object Vw32_pass_lwindow_to_system; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
72 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
73 /* Non nil if right window key events are passed on to Windows (this |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
74 only affects whether "tapping" the key opens the Start menu). */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
75 Lisp_Object Vw32_pass_rwindow_to_system; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
76 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
77 /* Virtual key code used to generate "phantom" key presses in order |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
78 to stop system from acting on Windows key events. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
79 Lisp_Object Vw32_phantom_key_code; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
80 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
81 /* Modifier associated with the left "Windows" key, or nil to act as a |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
82 normal key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
83 Lisp_Object Vw32_lwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
84 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
85 /* Modifier associated with the right "Windows" key, or nil to act as a |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
86 normal key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
87 Lisp_Object Vw32_rwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
88 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
89 /* Modifier associated with the "Apps" key, or nil to act as a normal |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
90 key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
91 Lisp_Object Vw32_apps_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
92 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
93 /* Value is nil if Num Lock acts as a function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
94 Lisp_Object Vw32_enable_num_lock; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
95 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
96 /* Value is nil if Caps Lock acts as a function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
97 Lisp_Object Vw32_enable_caps_lock; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
98 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
99 /* Modifier associated with Scroll Lock, or nil to act as a normal key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
100 Lisp_Object Vw32_scroll_lock_modifier; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
101 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
102 /* 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
|
103 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
|
104 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
|
105 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
106 /* Enable palette management. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
107 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
|
108 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
109 /* 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
|
110 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
|
111 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
|
112 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
113 /* 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
|
114 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
|
115 Lisp_Object Vw32_mouse_move_interval; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
116 |
13434 | 117 /* The name we're using in resource queries. */ |
118 Lisp_Object Vx_resource_name; | |
119 | |
120 /* Non nil if no window manager is in use. */ | |
121 Lisp_Object Vx_no_window_manager; | |
122 | |
123 /* The background and shape of the mouse pointer, and shape when not | |
124 over text or in the modeline. */ | |
125 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; | |
126 /* The shape when over mouse-sensitive text. */ | |
127 Lisp_Object Vx_sensitive_text_pointer_shape; | |
128 | |
129 /* Color of chars displayed in cursor box. */ | |
130 Lisp_Object Vx_cursor_fore_pixel; | |
131 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
132 /* Nonzero if using Windows. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
133 static int w32_in_use; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
134 |
13434 | 135 /* Search path for bitmap files. */ |
136 Lisp_Object Vx_bitmap_file_path; | |
137 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
138 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
139 Lisp_Object Vx_pixel_size_width_font_regexp; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
140 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
141 /* Alist of bdf fonts and the files that define them. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
142 Lisp_Object Vw32_bdf_filename_alist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
143 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
144 /* A flag to control how to display unibyte 8-bit character. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
145 int unibyte_display_via_language_environment; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
146 |
13434 | 147 /* Evaluate this expression to rebuild the section of syms_of_w32fns |
148 that initializes and staticpros the symbols declared below. Note | |
149 that Emacs 18 has a bug that keeps C-x C-e from being able to | |
150 evaluate this expression. | |
151 | |
152 (progn | |
153 ;; Accumulate a list of the symbols we want to initialize from the | |
154 ;; declarations at the top of the file. | |
155 (goto-char (point-min)) | |
156 (search-forward "/\*&&& symbols declared here &&&*\/\n") | |
157 (let (symbol-list) | |
158 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)") | |
159 (setq symbol-list | |
160 (cons (buffer-substring (match-beginning 1) (match-end 1)) | |
161 symbol-list)) | |
162 (forward-line 1)) | |
163 (setq symbol-list (nreverse symbol-list)) | |
164 ;; Delete the section of syms_of_... where we initialize the symbols. | |
165 (search-forward "\n /\*&&& init symbols here &&&*\/\n") | |
166 (let ((start (point))) | |
167 (while (looking-at "^ Q") | |
168 (forward-line 2)) | |
169 (kill-region start (point))) | |
170 ;; Write a new symbol initialization section. | |
171 (while symbol-list | |
172 (insert (format " %s = intern (\"" (car symbol-list))) | |
173 (let ((start (point))) | |
174 (insert (substring (car symbol-list) 1)) | |
175 (subst-char-in-region start (point) ?_ ?-)) | |
176 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list))) | |
177 (setq symbol-list (cdr symbol-list))))) | |
178 | |
179 */ | |
180 | |
181 /*&&& symbols declared here &&&*/ | |
182 Lisp_Object Qauto_raise; | |
183 Lisp_Object Qauto_lower; | |
184 Lisp_Object Qbackground_color; | |
185 Lisp_Object Qbar; | |
186 Lisp_Object Qborder_color; | |
187 Lisp_Object Qborder_width; | |
188 Lisp_Object Qbox; | |
189 Lisp_Object Qcursor_color; | |
190 Lisp_Object Qcursor_type; | |
191 Lisp_Object Qforeground_color; | |
192 Lisp_Object Qgeometry; | |
193 Lisp_Object Qicon_left; | |
194 Lisp_Object Qicon_top; | |
195 Lisp_Object Qicon_type; | |
196 Lisp_Object Qicon_name; | |
197 Lisp_Object Qinternal_border_width; | |
198 Lisp_Object Qleft; | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
199 Lisp_Object Qright; |
13434 | 200 Lisp_Object Qmouse_color; |
201 Lisp_Object Qnone; | |
202 Lisp_Object Qparent_id; | |
203 Lisp_Object Qscroll_bar_width; | |
204 Lisp_Object Qsuppress_icon; | |
205 Lisp_Object Qtop; | |
206 Lisp_Object Qundefined_color; | |
207 Lisp_Object Qvertical_scroll_bars; | |
208 Lisp_Object Qvisibility; | |
209 Lisp_Object Qwindow_id; | |
210 Lisp_Object Qx_frame_parameter; | |
211 Lisp_Object Qx_resource_name; | |
212 Lisp_Object Quser_position; | |
213 Lisp_Object Quser_size; | |
214 Lisp_Object Qdisplay; | |
215 | |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
216 Lisp_Object Qhyper; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
217 Lisp_Object Qsuper; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
218 Lisp_Object Qmeta; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
219 Lisp_Object Qalt; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
220 Lisp_Object Qctrl; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
221 Lisp_Object Qcontrol; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
222 Lisp_Object Qshift; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
223 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
224 /* 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
|
225 #define LMOUSE 1 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
226 #define MMOUSE 2 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
227 #define RMOUSE 4 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
228 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
229 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
|
230 static W32Msg saved_mouse_button_msg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
231 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
|
232 static W32Msg saved_mouse_move_msg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
233 static unsigned mouse_move_timer; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
234 |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
235 /* W95 mousewheel handler */ |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
236 unsigned int msh_mousewheel = 0; |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
237 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
238 #define MOUSE_BUTTON_ID 1 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
239 #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
|
240 |
13434 | 241 /* The below are defined in frame.c. */ |
242 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
|
243 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; |
13434 | 244 |
245 extern Lisp_Object Vwindow_system_version; | |
246 | |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
247 Lisp_Object Qface_set_after_frame_default; |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
248 |
13434 | 249 extern Lisp_Object last_mouse_scroll_bar; |
250 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
|
251 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
252 /* From w32term.c. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
253 extern Lisp_Object Vw32_num_mouse_buttons; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
254 extern Lisp_Object Vw32_recognize_altgr; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
255 |
13434 | 256 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
257 /* 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
|
258 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
259 check_w32 () |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
260 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
261 if (! w32_in_use) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
262 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
|
263 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
264 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
265 /* Nonzero if we can use mouse menus. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
266 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
|
267 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
268 int |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
269 have_menus_p () |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
270 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
271 return w32_in_use; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
272 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
273 |
13434 | 274 /* 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
|
275 and checking validity for W32. */ |
13434 | 276 |
277 FRAME_PTR | |
278 check_x_frame (frame) | |
279 Lisp_Object frame; | |
280 { | |
281 FRAME_PTR f; | |
282 | |
283 if (NILP (frame)) | |
284 f = selected_frame; | |
285 else | |
286 { | |
287 CHECK_LIVE_FRAME (frame, 0); | |
288 f = XFRAME (frame); | |
289 } | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
290 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
291 error ("non-w32 frame used"); |
13434 | 292 return f; |
293 } | |
294 | |
295 /* 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
|
296 nil stands for the selected frame--or, if that is not a w32 frame, |
13434 | 297 the first display on the list. */ |
298 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
299 static struct w32_display_info * |
13434 | 300 check_x_display_info (frame) |
301 Lisp_Object frame; | |
302 { | |
303 if (NILP (frame)) | |
304 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
305 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
|
306 return FRAME_W32_DISPLAY_INFO (selected_frame); |
13434 | 307 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
308 return &one_w32_display_info; |
13434 | 309 } |
310 else if (STRINGP (frame)) | |
311 return x_display_info_for_name (frame); | |
312 else | |
313 { | |
314 FRAME_PTR f; | |
315 | |
316 CHECK_LIVE_FRAME (frame, 0); | |
317 f = XFRAME (frame); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
318 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
319 error ("non-w32 frame used"); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
320 return FRAME_W32_DISPLAY_INFO (f); |
13434 | 321 } |
322 } | |
323 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
324 /* Return the Emacs frame-object corresponding to an w32 window. |
13434 | 325 It could be the frame's main window or an icon window. */ |
326 | |
327 /* This function can be called during GC, so use GC_xxx type test macros. */ | |
328 | |
329 struct frame * | |
330 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
|
331 struct w32_display_info *dpyinfo; |
13434 | 332 HWND wdesc; |
333 { | |
334 Lisp_Object tail, frame; | |
335 struct frame *f; | |
336 | |
337 for (tail = Vframe_list; GC_CONSP (tail); tail = XCONS (tail)->cdr) | |
338 { | |
339 frame = XCONS (tail)->car; | |
340 if (!GC_FRAMEP (frame)) | |
341 continue; | |
342 f = XFRAME (frame); | |
343 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
|
344 || FRAME_W32_DISPLAY_INFO (f) != dpyinfo) |
13434 | 345 continue; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
346 if (FRAME_W32_WINDOW (f) == wdesc) |
13434 | 347 return f; |
348 } | |
349 return 0; | |
350 } | |
351 | |
352 | |
353 | |
354 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap | |
355 id, which is just an int that this section returns. Bitmaps are | |
356 reference counted so they can be shared among frames. | |
357 | |
358 Bitmap indices are guaranteed to be > 0, so a negative number can | |
359 be used to indicate no bitmap. | |
360 | |
361 If you use x_create_bitmap_from_data, then you must keep track of | |
362 the bitmaps yourself. That is, creating a bitmap from the same | |
363 data more than once will not be caught. */ | |
364 | |
365 | |
366 /* Functions to access the contents of a bitmap, given an id. */ | |
367 | |
368 int | |
369 x_bitmap_height (f, id) | |
370 FRAME_PTR f; | |
371 int id; | |
372 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
373 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].height; |
13434 | 374 } |
375 | |
376 int | |
377 x_bitmap_width (f, id) | |
378 FRAME_PTR f; | |
379 int id; | |
380 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
381 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].width; |
13434 | 382 } |
383 | |
384 int | |
385 x_bitmap_pixmap (f, id) | |
386 FRAME_PTR f; | |
387 int id; | |
388 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
389 return (int) FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; |
13434 | 390 } |
391 | |
392 | |
393 /* Allocate a new bitmap record. Returns index of new record. */ | |
394 | |
395 static int | |
396 x_allocate_bitmap_record (f) | |
397 FRAME_PTR f; | |
398 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
399 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 400 int i; |
401 | |
402 if (dpyinfo->bitmaps == NULL) | |
403 { | |
404 dpyinfo->bitmaps_size = 10; | |
405 dpyinfo->bitmaps | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
406 = (struct w32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record)); |
13434 | 407 dpyinfo->bitmaps_last = 1; |
408 return 1; | |
409 } | |
410 | |
411 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size) | |
412 return ++dpyinfo->bitmaps_last; | |
413 | |
414 for (i = 0; i < dpyinfo->bitmaps_size; ++i) | |
415 if (dpyinfo->bitmaps[i].refcount == 0) | |
416 return i + 1; | |
417 | |
418 dpyinfo->bitmaps_size *= 2; | |
419 dpyinfo->bitmaps | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
420 = (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
|
421 dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record)); |
13434 | 422 return ++dpyinfo->bitmaps_last; |
423 } | |
424 | |
425 /* Add one reference to the reference count of the bitmap with id ID. */ | |
426 | |
427 void | |
428 x_reference_bitmap (f, id) | |
429 FRAME_PTR f; | |
430 int id; | |
431 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
432 ++FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; |
13434 | 433 } |
434 | |
435 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ | |
436 | |
437 int | |
438 x_create_bitmap_from_data (f, bits, width, height) | |
439 struct frame *f; | |
440 char *bits; | |
441 unsigned int width, height; | |
442 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
443 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 444 Pixmap bitmap; |
445 int id; | |
446 | |
447 bitmap = CreateBitmap (width, height, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
448 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
|
449 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits, |
13434 | 450 bits); |
451 | |
452 if (! bitmap) | |
453 return -1; | |
454 | |
455 id = x_allocate_bitmap_record (f); | |
456 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
457 dpyinfo->bitmaps[id - 1].file = NULL; | |
458 dpyinfo->bitmaps[id - 1].hinst = NULL; | |
459 dpyinfo->bitmaps[id - 1].refcount = 1; | |
460 dpyinfo->bitmaps[id - 1].depth = 1; | |
461 dpyinfo->bitmaps[id - 1].height = height; | |
462 dpyinfo->bitmaps[id - 1].width = width; | |
463 | |
464 return id; | |
465 } | |
466 | |
467 /* Create bitmap from file FILE for frame F. */ | |
468 | |
469 int | |
470 x_create_bitmap_from_file (f, file) | |
471 struct frame *f; | |
472 Lisp_Object file; | |
473 { | |
474 return -1; | |
475 #if 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
476 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 477 unsigned int width, height; |
478 Pixmap bitmap; | |
479 int xhot, yhot, result, id; | |
480 Lisp_Object found; | |
481 int fd; | |
482 char *filename; | |
483 HINSTANCE hinst; | |
484 | |
485 /* Look for an existing bitmap with the same name. */ | |
486 for (id = 0; id < dpyinfo->bitmaps_last; ++id) | |
487 { | |
488 if (dpyinfo->bitmaps[id].refcount | |
489 && dpyinfo->bitmaps[id].file | |
490 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) | |
491 { | |
492 ++dpyinfo->bitmaps[id].refcount; | |
493 return id + 1; | |
494 } | |
495 } | |
496 | |
497 /* Search bitmap-file-path for the file, if appropriate. */ | |
498 fd = openp (Vx_bitmap_file_path, file, "", &found, 0); | |
499 if (fd < 0) | |
500 return -1; | |
23407
4587be644789
(x_create_bitmap_from_file): Skip special files.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23314
diff
changeset
|
501 /* LoadLibraryEx won't handle special files handled by Emacs handler. */ |
4587be644789
(x_create_bitmap_from_file): Skip special files.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23314
diff
changeset
|
502 if (fd == 0) |
4587be644789
(x_create_bitmap_from_file): Skip special files.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23314
diff
changeset
|
503 return -1; |
13434 | 504 close (fd); |
505 | |
506 filename = (char *) XSTRING (found)->data; | |
507 | |
508 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE); | |
509 | |
510 if (hinst == NULL) | |
511 return -1; | |
512 | |
513 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
514 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
13434 | 515 filename, &width, &height, &bitmap, &xhot, &yhot); |
516 if (result != BitmapSuccess) | |
517 return -1; | |
518 | |
519 id = x_allocate_bitmap_record (f); | |
520 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
521 dpyinfo->bitmaps[id - 1].refcount = 1; | |
522 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1); | |
523 dpyinfo->bitmaps[id - 1].depth = 1; | |
524 dpyinfo->bitmaps[id - 1].height = height; | |
525 dpyinfo->bitmaps[id - 1].width = width; | |
526 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); | |
527 | |
528 return id; | |
529 #endif | |
530 } | |
531 | |
532 /* Remove reference to bitmap with id number ID. */ | |
533 | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
534 void |
13434 | 535 x_destroy_bitmap (f, id) |
536 FRAME_PTR f; | |
537 int id; | |
538 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
539 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 540 |
541 if (id > 0) | |
542 { | |
543 --dpyinfo->bitmaps[id - 1].refcount; | |
544 if (dpyinfo->bitmaps[id - 1].refcount == 0) | |
545 { | |
546 BLOCK_INPUT; | |
547 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap); | |
548 if (dpyinfo->bitmaps[id - 1].file) | |
549 { | |
550 free (dpyinfo->bitmaps[id - 1].file); | |
551 dpyinfo->bitmaps[id - 1].file = NULL; | |
552 } | |
553 UNBLOCK_INPUT; | |
554 } | |
555 } | |
556 } | |
557 | |
558 /* Free all the bitmaps for the display specified by DPYINFO. */ | |
559 | |
560 static void | |
561 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
|
562 struct w32_display_info *dpyinfo; |
13434 | 563 { |
564 int i; | |
565 for (i = 0; i < dpyinfo->bitmaps_last; i++) | |
566 if (dpyinfo->bitmaps[i].refcount > 0) | |
567 { | |
568 DeleteObject (dpyinfo->bitmaps[i].pixmap); | |
569 if (dpyinfo->bitmaps[i].file) | |
570 free (dpyinfo->bitmaps[i].file); | |
571 } | |
572 dpyinfo->bitmaps_last = 0; | |
573 } | |
574 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
575 /* Connect the frame-parameter names for W32 frames |
13434 | 576 to the ways of passing the parameter values to the window system. |
577 | |
578 The name of a parameter, as a Lisp symbol, | |
579 has an `x-frame-parameter' property which is an integer in Lisp | |
580 but can be interpreted as an `enum x_frame_parm' in C. */ | |
581 | |
582 enum x_frame_parm | |
583 { | |
584 X_PARM_FOREGROUND_COLOR, | |
585 X_PARM_BACKGROUND_COLOR, | |
586 X_PARM_MOUSE_COLOR, | |
587 X_PARM_CURSOR_COLOR, | |
588 X_PARM_BORDER_COLOR, | |
589 X_PARM_ICON_TYPE, | |
590 X_PARM_FONT, | |
591 X_PARM_BORDER_WIDTH, | |
592 X_PARM_INTERNAL_BORDER_WIDTH, | |
593 X_PARM_NAME, | |
594 X_PARM_AUTORAISE, | |
595 X_PARM_AUTOLOWER, | |
596 X_PARM_VERT_SCROLL_BAR, | |
597 X_PARM_VISIBILITY, | |
598 X_PARM_MENU_BAR_LINES | |
599 }; | |
600 | |
601 | |
602 struct x_frame_parm_table | |
603 { | |
604 char *name; | |
605 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ ); | |
606 }; | |
607 | |
608 void x_set_foreground_color (); | |
609 void x_set_background_color (); | |
610 void x_set_mouse_color (); | |
611 void x_set_cursor_color (); | |
612 void x_set_border_color (); | |
613 void x_set_cursor_type (); | |
614 void x_set_icon_type (); | |
615 void x_set_icon_name (); | |
616 void x_set_font (); | |
617 void x_set_border_width (); | |
618 void x_set_internal_border_width (); | |
619 void x_explicitly_set_name (); | |
620 void x_set_autoraise (); | |
621 void x_set_autolower (); | |
622 void x_set_vertical_scroll_bars (); | |
623 void x_set_visibility (); | |
624 void x_set_menu_bar_lines (); | |
625 void x_set_scroll_bar_width (); | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
626 void x_set_title (); |
13434 | 627 void x_set_unsplittable (); |
628 | |
629 static struct x_frame_parm_table x_frame_parms[] = | |
630 { | |
631 "auto-raise", x_set_autoraise, | |
632 "auto-lower", x_set_autolower, | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
633 "background-color", x_set_background_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
634 "border-color", x_set_border_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
635 "border-width", x_set_border_width, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
636 "cursor-color", x_set_cursor_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
637 "cursor-type", x_set_cursor_type, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
638 "font", x_set_font, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
639 "foreground-color", x_set_foreground_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
640 "icon-name", x_set_icon_name, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
641 "icon-type", x_set_icon_type, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
642 "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
|
643 "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
|
644 "mouse-color", x_set_mouse_color, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
645 "name", x_explicitly_set_name, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
646 "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
|
647 "title", x_set_title, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
648 "unsplittable", x_set_unsplittable, |
13434 | 649 "vertical-scroll-bars", x_set_vertical_scroll_bars, |
650 "visibility", x_set_visibility, | |
651 }; | |
652 | |
653 /* 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
|
654 the Lisp symbol names of parameters relevant to W32. */ |
13434 | 655 |
656 init_x_parm_symbols () | |
657 { | |
658 int i; | |
659 | |
660 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++) | |
661 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, | |
662 make_number (i)); | |
663 } | |
664 | |
665 /* Change the parameters of FRAME as specified by ALIST. | |
666 If a parameter is not specially recognized, do nothing; | |
667 otherwise call the `x_set_...' function for that parameter. */ | |
668 | |
669 void | |
670 x_set_frame_parameters (f, alist) | |
671 FRAME_PTR f; | |
672 Lisp_Object alist; | |
673 { | |
674 Lisp_Object tail; | |
675 | |
676 /* If both of these parameters are present, it's more efficient to | |
677 set them both at once. So we wait until we've looked at the | |
678 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
|
679 int width, height; |
13434 | 680 |
681 /* Same here. */ | |
682 Lisp_Object left, top; | |
683 | |
684 /* Same with these. */ | |
685 Lisp_Object icon_left, icon_top; | |
686 | |
687 /* Record in these vectors all the parms specified. */ | |
688 Lisp_Object *parms; | |
689 Lisp_Object *values; | |
690 int i; | |
691 int left_no_change = 0, top_no_change = 0; | |
692 int icon_left_no_change = 0, icon_top_no_change = 0; | |
693 | |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
694 struct gcpro gcpro1, gcpro2; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
695 |
13434 | 696 i = 0; |
697 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
698 i++; | |
699 | |
700 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
701 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
702 | |
703 /* Extract parm names and values into those vectors. */ | |
704 | |
705 i = 0; | |
706 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
707 { | |
708 Lisp_Object elt, prop, val; | |
709 | |
710 elt = Fcar (tail); | |
711 parms[i] = Fcar (elt); | |
712 values[i] = Fcdr (elt); | |
713 i++; | |
714 } | |
715 | |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
716 /* TAIL and ALIST are not used again below here. */ |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
717 alist = tail = Qnil; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
718 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
719 GCPRO2 (*parms, *values); |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
720 gcpro1.nvars = i; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
721 gcpro2.nvars = i; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
722 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
723 /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP, |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
724 because their values appear in VALUES and strings are not valid. */ |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
725 top = left = Qunbound; |
13434 | 726 icon_left = icon_top = Qunbound; |
727 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
728 /* 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
|
729 width = FRAME_WIDTH (f); |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
730 height = FRAME_HEIGHT (f); |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
731 |
13434 | 732 /* Now process them in reverse of specified order. */ |
733 for (i--; i >= 0; i--) | |
734 { | |
735 Lisp_Object prop, val; | |
736 | |
737 prop = parms[i]; | |
738 val = values[i]; | |
739 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
740 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
|
741 width = XFASTINT (val); |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
742 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
|
743 height = XFASTINT (val); |
13434 | 744 else if (EQ (prop, Qtop)) |
745 top = val; | |
746 else if (EQ (prop, Qleft)) | |
747 left = val; | |
748 else if (EQ (prop, Qicon_top)) | |
749 icon_top = val; | |
750 else if (EQ (prop, Qicon_left)) | |
751 icon_left = val; | |
752 else | |
753 { | |
754 register Lisp_Object param_index, old_value; | |
755 | |
756 param_index = Fget (prop, Qx_frame_parameter); | |
757 old_value = get_frame_param (f, prop); | |
758 store_frame_param (f, prop, val); | |
759 if (NATNUMP (param_index) | |
760 && (XFASTINT (param_index) | |
761 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) | |
14353 | 762 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); |
13434 | 763 } |
764 } | |
765 | |
766 /* Don't die if just one of these was set. */ | |
767 if (EQ (left, Qunbound)) | |
768 { | |
769 left_no_change = 1; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
770 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
|
771 left = Fcons (Qplus, Fcons (make_number (f->output_data.w32->left_pos), Qnil)); |
13434 | 772 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
773 XSETINT (left, f->output_data.w32->left_pos); |
13434 | 774 } |
775 if (EQ (top, Qunbound)) | |
776 { | |
777 top_no_change = 1; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
778 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
|
779 top = Fcons (Qplus, Fcons (make_number (f->output_data.w32->top_pos), Qnil)); |
13434 | 780 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
781 XSETINT (top, f->output_data.w32->top_pos); |
13434 | 782 } |
783 | |
784 /* If one of the icon positions was not set, preserve or default it. */ | |
785 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left)) | |
786 { | |
787 icon_left_no_change = 1; | |
788 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); | |
789 if (NILP (icon_left)) | |
790 XSETINT (icon_left, 0); | |
791 } | |
792 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top)) | |
793 { | |
794 icon_top_no_change = 1; | |
795 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); | |
796 if (NILP (icon_top)) | |
797 XSETINT (icon_top, 0); | |
798 } | |
799 | |
800 /* Don't set these parameters unless they've been explicitly | |
801 specified. The window might be mapped or resized while we're in | |
802 this function, and we don't want to override that unless the lisp | |
803 code has asked for it. | |
804 | |
805 Don't set these parameters unless they actually differ from the | |
806 window's current parameters; the window may not actually exist | |
807 yet. */ | |
808 { | |
809 Lisp_Object frame; | |
810 | |
811 check_frame_size (f, &height, &width); | |
812 | |
813 XSETFRAME (frame, f); | |
814 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
815 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
|
816 || 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
|
817 Fset_frame_size (frame, make_number (width), make_number (height)); |
13434 | 818 |
819 if ((!NILP (left) || !NILP (top)) | |
820 && ! (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
|
821 && ! (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
|
822 && NUMBERP (top) && XINT (top) == f->output_data.w32->top_pos)) |
13434 | 823 { |
824 int leftpos = 0; | |
825 int toppos = 0; | |
826 | |
827 /* Record the signs. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
828 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); |
13434 | 829 if (EQ (left, Qminus)) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
830 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 831 else if (INTEGERP (left)) |
832 { | |
833 leftpos = XINT (left); | |
834 if (leftpos < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
835 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 836 } |
837 else if (CONSP (left) && EQ (XCONS (left)->car, Qminus) | |
838 && CONSP (XCONS (left)->cdr) | |
839 && INTEGERP (XCONS (XCONS (left)->cdr)->car)) | |
840 { | |
841 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
|
842 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 843 } |
844 else if (CONSP (left) && EQ (XCONS (left)->car, Qplus) | |
845 && CONSP (XCONS (left)->cdr) | |
846 && INTEGERP (XCONS (XCONS (left)->cdr)->car)) | |
847 { | |
848 leftpos = XINT (XCONS (XCONS (left)->cdr)->car); | |
849 } | |
850 | |
851 if (EQ (top, Qminus)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
852 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 853 else if (INTEGERP (top)) |
854 { | |
855 toppos = XINT (top); | |
856 if (toppos < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
857 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 858 } |
859 else if (CONSP (top) && EQ (XCONS (top)->car, Qminus) | |
860 && CONSP (XCONS (top)->cdr) | |
861 && INTEGERP (XCONS (XCONS (top)->cdr)->car)) | |
862 { | |
863 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
|
864 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 865 } |
866 else if (CONSP (top) && EQ (XCONS (top)->car, Qplus) | |
867 && CONSP (XCONS (top)->cdr) | |
868 && INTEGERP (XCONS (XCONS (top)->cdr)->car)) | |
869 { | |
870 toppos = XINT (XCONS (XCONS (top)->cdr)->car); | |
871 } | |
872 | |
873 | |
874 /* 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
|
875 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
|
876 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
|
877 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
878 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 879 |
880 /* Actually set that position, and convert to absolute. */ | |
881 x_set_offset (f, leftpos, toppos, -1); | |
882 } | |
883 | |
884 if ((!NILP (icon_left) || !NILP (icon_top)) | |
885 && ! (icon_left_no_change && icon_top_no_change)) | |
886 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); | |
887 } | |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
888 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
889 UNGCPRO; |
13434 | 890 } |
891 | |
892 /* Store the screen positions of frame F into XPTR and YPTR. | |
893 These are the positions of the containing window manager window, | |
894 not Emacs's own window. */ | |
895 | |
896 void | |
897 x_real_positions (f, xptr, yptr) | |
898 FRAME_PTR f; | |
899 int *xptr, *yptr; | |
900 { | |
901 POINT pt; | |
14353 | 902 |
903 { | |
904 RECT rect; | |
13434 | 905 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
906 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
|
907 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f)); |
13434 | 908 |
14353 | 909 pt.x = rect.left; |
910 pt.y = rect.top; | |
911 } | |
912 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
913 ClientToScreen (FRAME_W32_WINDOW(f), &pt); |
13434 | 914 |
915 *xptr = pt.x; | |
916 *yptr = pt.y; | |
917 } | |
918 | |
919 /* Insert a description of internally-recorded parameters of frame X | |
920 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
|
921 Only parameters that are specific to W32 |
13434 | 922 and whose values are not correctly recorded in the frame's |
923 param_alist need to be considered here. */ | |
924 | |
925 x_report_frame_params (f, alistptr) | |
926 struct frame *f; | |
927 Lisp_Object *alistptr; | |
928 { | |
929 char buf[16]; | |
930 Lisp_Object tem; | |
931 | |
932 /* Represent negative positions (off the top or left screen edge) | |
933 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
|
934 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
|
935 if (f->output_data.w32->left_pos >= 0) |
13434 | 936 store_in_alist (alistptr, Qleft, tem); |
937 else | |
938 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil))); | |
939 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
940 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
|
941 if (f->output_data.w32->top_pos >= 0) |
13434 | 942 store_in_alist (alistptr, Qtop, tem); |
943 else | |
944 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil))); | |
945 | |
946 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
|
947 make_number (f->output_data.w32->border_width)); |
13434 | 948 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
|
949 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
|
950 sprintf (buf, "%ld", (long) FRAME_W32_WINDOW (f)); |
13434 | 951 store_in_alist (alistptr, Qwindow_id, |
952 build_string (buf)); | |
953 store_in_alist (alistptr, Qicon_name, f->icon_name); | |
954 FRAME_SAMPLE_VISIBILITY (f); | |
955 store_in_alist (alistptr, Qvisibility, | |
956 (FRAME_VISIBLE_P (f) ? Qt | |
957 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); | |
958 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
|
959 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->car); |
13434 | 960 } |
961 | |
962 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
963 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
|
964 "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
|
965 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
|
966 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
|
967 (red, green, blue, name) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
968 Lisp_Object red, green, blue, name; |
13434 | 969 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
970 Lisp_Object rgb; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
971 Lisp_Object oldrgb = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
972 Lisp_Object entry; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
973 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
974 CHECK_NUMBER (red, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
975 CHECK_NUMBER (green, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
976 CHECK_NUMBER (blue, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
977 CHECK_STRING (name, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
978 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
979 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
|
980 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
981 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
982 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
983 /* 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
|
984 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
|
985 if (NILP (entry)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
986 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
987 entry = Fcons (name, rgb); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
988 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
|
989 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
990 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
991 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
992 oldrgb = Fcdr (entry); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
993 Fsetcdr (entry, rgb); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
994 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
995 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
996 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
997 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
998 return (oldrgb); |
13434 | 999 } |
1000 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1001 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
|
1002 "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
|
1003 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
|
1004 \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1005 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
|
1006 R G B name\n\ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1007 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
|
1008 (filename) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1009 Lisp_Object filename; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1010 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1011 FILE *fp; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1012 Lisp_Object cmap = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1013 Lisp_Object abspath; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1014 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1015 CHECK_STRING (filename, 0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1016 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
|
1017 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1018 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
|
1019 if (fp) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1020 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1021 char buf[512]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1022 int red, green, blue; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1023 int num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1024 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1025 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1026 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1027 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
|
1028 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
|
1029 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1030 char *name = buf + num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1031 num = strlen (name) - 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1032 if (name[num] == '\n') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1033 name[num] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1034 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
|
1035 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
|
1036 cmap); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1037 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1038 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1039 fclose (fp); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1040 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1041 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1042 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1043 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1044 return cmap; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1045 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1046 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1047 /* The default colors for the w32 color map */ |
13434 | 1048 typedef struct colormap_t |
1049 { | |
1050 char *name; | |
1051 COLORREF colorref; | |
1052 } colormap_t; | |
1053 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1054 colormap_t w32_color_map[] = |
13434 | 1055 { |
14983
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1056 {"snow" , PALETTERGB (255,250,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1057 {"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
|
1058 {"GhostWhite" , PALETTERGB (248,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1059 {"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
|
1060 {"WhiteSmoke" , PALETTERGB (245,245,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1061 {"gainsboro" , PALETTERGB (220,220,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1062 {"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
|
1063 {"FloralWhite" , PALETTERGB (255,250,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1064 {"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
|
1065 {"OldLace" , PALETTERGB (253,245,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1066 {"linen" , PALETTERGB (250,240,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1067 {"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
|
1068 {"AntiqueWhite" , PALETTERGB (250,235,215)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1069 {"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
|
1070 {"PapayaWhip" , PALETTERGB (255,239,213)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1071 {"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
|
1072 {"BlanchedAlmond" , PALETTERGB (255,235,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1073 {"bisque" , PALETTERGB (255,228,196)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1074 {"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
|
1075 {"PeachPuff" , PALETTERGB (255,218,185)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1076 {"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
|
1077 {"NavajoWhite" , PALETTERGB (255,222,173)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1078 {"moccasin" , PALETTERGB (255,228,181)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1079 {"cornsilk" , PALETTERGB (255,248,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1080 {"ivory" , PALETTERGB (255,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1081 {"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
|
1082 {"LemonChiffon" , PALETTERGB (255,250,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1083 {"seashell" , PALETTERGB (255,245,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1084 {"honeydew" , PALETTERGB (240,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1085 {"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
|
1086 {"MintCream" , PALETTERGB (245,255,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1087 {"azure" , PALETTERGB (240,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1088 {"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
|
1089 {"AliceBlue" , PALETTERGB (240,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1090 {"lavender" , PALETTERGB (230,230,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1091 {"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
|
1092 {"LavenderBlush" , PALETTERGB (255,240,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1093 {"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
|
1094 {"MistyRose" , PALETTERGB (255,228,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1095 {"white" , PALETTERGB (255,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1096 {"black" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1097 {"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
|
1098 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1099 {"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
|
1100 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1101 {"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
|
1102 {"DimGray" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1103 {"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
|
1104 {"DimGrey" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1105 {"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
|
1106 {"SlateGray" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1107 {"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
|
1108 {"SlateGrey" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1109 {"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
|
1110 {"LightSlateGray" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1111 {"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
|
1112 {"LightSlateGrey" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1113 {"gray" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1114 {"grey" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1115 {"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
|
1116 {"LightGrey" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1117 {"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
|
1118 {"LightGray" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1119 {"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
|
1120 {"MidnightBlue" , PALETTERGB ( 25, 25,112)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1121 {"navy" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1122 {"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
|
1123 {"NavyBlue" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1124 {"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
|
1125 {"CornflowerBlue" , PALETTERGB (100,149,237)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1126 {"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
|
1127 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1128 {"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
|
1129 {"SlateBlue" , PALETTERGB (106, 90,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1130 {"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
|
1131 {"MediumSlateBlue" , PALETTERGB (123,104,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1132 {"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
|
1133 {"LightSlateBlue" , PALETTERGB (132,112,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1134 {"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
|
1135 {"MediumBlue" , PALETTERGB ( 0, 0,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1136 {"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
|
1137 {"RoyalBlue" , PALETTERGB ( 65,105,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1138 {"blue" , PALETTERGB ( 0, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1139 {"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
|
1140 {"DodgerBlue" , PALETTERGB ( 30,144,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1141 {"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
|
1142 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1143 {"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
|
1144 {"SkyBlue" , PALETTERGB (135,206,235)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1145 {"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
|
1146 {"LightSkyBlue" , PALETTERGB (135,206,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1147 {"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
|
1148 {"SteelBlue" , PALETTERGB ( 70,130,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1149 {"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
|
1150 {"LightSteelBlue" , PALETTERGB (176,196,222)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1151 {"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
|
1152 {"LightBlue" , PALETTERGB (173,216,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1153 {"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
|
1154 {"PowderBlue" , PALETTERGB (176,224,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1155 {"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
|
1156 {"PaleTurquoise" , PALETTERGB (175,238,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1157 {"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
|
1158 {"DarkTurquoise" , PALETTERGB ( 0,206,209)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1159 {"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
|
1160 {"MediumTurquoise" , PALETTERGB ( 72,209,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1161 {"turquoise" , PALETTERGB ( 64,224,208)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1162 {"cyan" , PALETTERGB ( 0,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1163 {"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
|
1164 {"LightCyan" , PALETTERGB (224,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1165 {"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
|
1166 {"CadetBlue" , PALETTERGB ( 95,158,160)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1167 {"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
|
1168 {"MediumAquamarine" , PALETTERGB (102,205,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1169 {"aquamarine" , PALETTERGB (127,255,212)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1170 {"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
|
1171 {"DarkGreen" , PALETTERGB ( 0,100, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1172 {"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
|
1173 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1174 {"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
|
1175 {"DarkSeaGreen" , PALETTERGB (143,188,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1176 {"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
|
1177 {"SeaGreen" , PALETTERGB ( 46,139, 87)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1178 {"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
|
1179 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1180 {"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
|
1181 {"LightSeaGreen" , PALETTERGB ( 32,178,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1182 {"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
|
1183 {"PaleGreen" , PALETTERGB (152,251,152)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1184 {"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
|
1185 {"SpringGreen" , PALETTERGB ( 0,255,127)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1186 {"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
|
1187 {"LawnGreen" , PALETTERGB (124,252, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1188 {"green" , PALETTERGB ( 0,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1189 {"chartreuse" , PALETTERGB (127,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1190 {"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
|
1191 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1192 {"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
|
1193 {"GreenYellow" , PALETTERGB (173,255, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1194 {"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
|
1195 {"LimeGreen" , PALETTERGB ( 50,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1196 {"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
|
1197 {"YellowGreen" , PALETTERGB (154,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1198 {"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
|
1199 {"ForestGreen" , PALETTERGB ( 34,139, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1200 {"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
|
1201 {"OliveDrab" , PALETTERGB (107,142, 35)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1202 {"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
|
1203 {"DarkKhaki" , PALETTERGB (189,183,107)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1204 {"khaki" , PALETTERGB (240,230,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1205 {"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
|
1206 {"PaleGoldenrod" , PALETTERGB (238,232,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1207 {"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
|
1208 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1209 {"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
|
1210 {"LightYellow" , PALETTERGB (255,255,224)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1211 {"yellow" , PALETTERGB (255,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1212 {"gold" , PALETTERGB (255,215, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1213 {"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
|
1214 {"LightGoldenrod" , PALETTERGB (238,221,130)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1215 {"goldenrod" , PALETTERGB (218,165, 32)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1216 {"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
|
1217 {"DarkGoldenrod" , PALETTERGB (184,134, 11)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1218 {"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
|
1219 {"RosyBrown" , PALETTERGB (188,143,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1220 {"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
|
1221 {"IndianRed" , PALETTERGB (205, 92, 92)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1222 {"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
|
1223 {"SaddleBrown" , PALETTERGB (139, 69, 19)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1224 {"sienna" , PALETTERGB (160, 82, 45)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1225 {"peru" , PALETTERGB (205,133, 63)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1226 {"burlywood" , PALETTERGB (222,184,135)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1227 {"beige" , PALETTERGB (245,245,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1228 {"wheat" , PALETTERGB (245,222,179)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1229 {"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
|
1230 {"SandyBrown" , PALETTERGB (244,164, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1231 {"tan" , PALETTERGB (210,180,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1232 {"chocolate" , PALETTERGB (210,105, 30)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1233 {"firebrick" , PALETTERGB (178,34, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1234 {"brown" , PALETTERGB (165,42, 42)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1235 {"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
|
1236 {"DarkSalmon" , PALETTERGB (233,150,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1237 {"salmon" , PALETTERGB (250,128,114)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1238 {"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
|
1239 {"LightSalmon" , PALETTERGB (255,160,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1240 {"orange" , PALETTERGB (255,165, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1241 {"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
|
1242 {"DarkOrange" , PALETTERGB (255,140, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1243 {"coral" , PALETTERGB (255,127, 80)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1244 {"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
|
1245 {"LightCoral" , PALETTERGB (240,128,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1246 {"tomato" , PALETTERGB (255, 99, 71)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1247 {"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
|
1248 {"OrangeRed" , PALETTERGB (255, 69, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1249 {"red" , PALETTERGB (255, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1250 {"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
|
1251 {"HotPink" , PALETTERGB (255,105,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1252 {"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
|
1253 {"DeepPink" , PALETTERGB (255, 20,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1254 {"pink" , PALETTERGB (255,192,203)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1255 {"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
|
1256 {"LightPink" , PALETTERGB (255,182,193)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1257 {"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
|
1258 {"PaleVioletRed" , PALETTERGB (219,112,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1259 {"maroon" , PALETTERGB (176, 48, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1260 {"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
|
1261 {"MediumVioletRed" , PALETTERGB (199, 21,133)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1262 {"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
|
1263 {"VioletRed" , PALETTERGB (208, 32,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1264 {"magenta" , PALETTERGB (255, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1265 {"violet" , PALETTERGB (238,130,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1266 {"plum" , PALETTERGB (221,160,221)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1267 {"orchid" , PALETTERGB (218,112,214)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1268 {"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
|
1269 {"MediumOrchid" , PALETTERGB (186, 85,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1270 {"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
|
1271 {"DarkOrchid" , PALETTERGB (153, 50,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1272 {"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
|
1273 {"DarkViolet" , PALETTERGB (148, 0,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1274 {"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
|
1275 {"BlueViolet" , PALETTERGB (138, 43,226)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1276 {"purple" , PALETTERGB (160, 32,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1277 {"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
|
1278 {"MediumPurple" , PALETTERGB (147,112,219)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1279 {"thistle" , PALETTERGB (216,191,216)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1280 {"gray0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1281 {"grey0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1282 {"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
|
1283 {"DarkGrey" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1284 {"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
|
1285 {"DarkGray" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1286 {"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
|
1287 {"DarkBlue" , PALETTERGB ( 0, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1288 {"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
|
1289 {"DarkCyan" , PALETTERGB ( 0,139,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1290 {"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
|
1291 {"DarkMagenta" , PALETTERGB (139, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1292 {"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
|
1293 {"DarkRed" , PALETTERGB (139, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1294 {"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
|
1295 {"LightGreen" , PALETTERGB (144,238,144)}, |
13434 | 1296 }; |
1297 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1298 DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map, |
13434 | 1299 0, 0, 0, "Return the default color map.") |
1300 () | |
1301 { | |
1302 int i; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1303 colormap_t *pc = w32_color_map; |
13434 | 1304 Lisp_Object cmap; |
1305 | |
1306 BLOCK_INPUT; | |
1307 | |
1308 cmap = Qnil; | |
1309 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1310 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]); |
13434 | 1311 pc++, i++) |
1312 cmap = Fcons (Fcons (build_string (pc->name), | |
1313 make_number (pc->colorref)), | |
1314 cmap); | |
1315 | |
1316 UNBLOCK_INPUT; | |
1317 | |
1318 return (cmap); | |
1319 } | |
1320 | |
1321 Lisp_Object | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1322 w32_to_x_color (rgb) |
13434 | 1323 Lisp_Object rgb; |
1324 { | |
1325 Lisp_Object color; | |
1326 | |
1327 CHECK_NUMBER (rgb, 0); | |
1328 | |
1329 BLOCK_INPUT; | |
1330 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1331 color = Frassq (rgb, Vw32_color_map); |
13434 | 1332 |
1333 UNBLOCK_INPUT; | |
1334 | |
1335 if (!NILP (color)) | |
1336 return (Fcar (color)); | |
1337 else | |
1338 return Qnil; | |
1339 } | |
1340 | |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1341 COLORREF |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1342 w32_color_map_lookup (colorname) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1343 char *colorname; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1344 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1345 Lisp_Object tail, ret = Qnil; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1346 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1347 BLOCK_INPUT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1348 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1349 for (tail = Vw32_color_map; !NILP (tail); tail = Fcdr (tail)) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1350 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1351 register Lisp_Object elt, tem; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1352 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1353 elt = Fcar (tail); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1354 if (!CONSP (elt)) continue; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1355 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1356 tem = Fcar (elt); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1357 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1358 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1359 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1360 ret = XUINT (Fcdr (elt)); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1361 break; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1362 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1363 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1364 QUIT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1365 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1366 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1367 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1368 UNBLOCK_INPUT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1369 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1370 return ret; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1371 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1372 |
13434 | 1373 COLORREF |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1374 x_to_w32_color (colorname) |
13434 | 1375 char * colorname; |
1376 { | |
1377 register Lisp_Object tail, ret = Qnil; | |
1378 | |
1379 BLOCK_INPUT; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1380 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1381 if (colorname[0] == '#') |
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 /* 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
|
1384 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1385 int size; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1386 color = colorname + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1387 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1388 size = strlen(color); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1389 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
|
1390 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1391 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1392 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1393 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1394 size /= 3; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1395 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1396 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1397 for (i = 0; i < 3; i++) |
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 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1400 char t; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1401 unsigned long value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1402 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1403 /* 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
|
1404 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
|
1405 our numbers, and we don't. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1406 if (!isxdigit(color[0]) || color[1] == 'x') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1407 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1408 t = color[size]; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1409 color[size] = '\0'; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1410 value = strtoul(color, &end, 16); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1411 color[size] = t; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1412 if (errno == ERANGE || end - color != size) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1413 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1414 switch (size) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1415 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1416 case 1: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1417 value = value * 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1418 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1419 case 2: |
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 case 3: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1422 value /= 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1423 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1424 case 4: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1425 value /= 0x100; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1426 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1427 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1428 colorval |= (value << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1429 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1430 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1431 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1432 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1433 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1434 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1435 color = end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1436 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1437 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1438 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1439 else if (strnicmp(colorname, "rgb:", 4) == 0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1440 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1441 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1442 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1443 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1444 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1445 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1446 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1447 color = colorname + 4; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1448 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1449 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1450 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1451 unsigned long value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1452 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1453 /* 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
|
1454 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
|
1455 our numbers, and we don't. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1456 if (!isxdigit(color[0]) || color[1] == 'x') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1457 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1458 value = strtoul(color, &end, 16); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1459 if (errno == ERANGE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1460 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1461 switch (end - color) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1462 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1463 case 1: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1464 value = value * 0x10 + value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1465 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1466 case 2: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1467 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1468 case 3: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1469 value /= 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1470 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1471 case 4: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1472 value /= 0x100; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1473 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1474 default: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1475 value = ULONG_MAX; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1476 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1477 if (value == ULONG_MAX) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1478 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1479 colorval |= (value << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1480 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1481 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1482 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1483 if (*end != '\0') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1484 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1485 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1486 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1487 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1488 if (*end != '/') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1489 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1490 color = end + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1491 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1492 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1493 else if (strnicmp(colorname, "rgbi:", 5) == 0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1494 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1495 /* This is an RGB Intensity specification. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1496 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1497 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1498 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1499 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1500 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1501 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1502 color = colorname + 5; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1503 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1504 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1505 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1506 double value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1507 UINT val; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1508 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1509 value = strtod(color, &end); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1510 if (errno == ERANGE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1511 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1512 if (value < 0.0 || value > 1.0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1513 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1514 val = (UINT)(0x100 * value); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1515 /* 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
|
1516 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
|
1517 fixes the 1.0 case. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1518 if (val == 0x100) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1519 val = 0xFF; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1520 colorval |= (val << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1521 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1522 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1523 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1524 if (*end != '\0') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1525 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1526 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1527 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1528 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1529 if (*end != '/') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1530 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1531 color = end + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1532 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1533 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1534 /* 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
|
1535 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
|
1536 RGB. */ |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1537 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1538 /* If we fail to lookup the color name in w32_color_map, then check the |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1539 colorname to see if it can be crudely approximated: If the X color |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1540 ends in a number (e.g., "darkseagreen2"), strip the number and |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1541 return the result of looking up the base color name. */ |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1542 ret = w32_color_map_lookup (colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1543 if (NILP (ret)) |
13434 | 1544 { |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1545 int len = strlen (colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1546 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1547 if (isdigit (colorname[len - 1])) |
13434 | 1548 { |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1549 char *ptr, *approx = alloca (len); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1550 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1551 strcpy (approx, colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1552 ptr = &approx[len - 1]; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1553 while (ptr > approx && isdigit (*ptr)) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1554 *ptr-- = '\0'; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1555 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1556 ret = w32_color_map_lookup (approx); |
13434 | 1557 } |
1558 } | |
1559 | |
1560 UNBLOCK_INPUT; | |
1561 return ret; | |
1562 } | |
1563 | |
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 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1566 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
|
1567 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1568 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
|
1569 LOGPALETTE * log_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1570 HPALETTE new_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1571 int i; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1572 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1573 /* 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
|
1574 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
|
1575 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1576 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1577 log_palette = (LOGPALETTE *) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1578 alloca (sizeof (LOGPALETTE) + |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1579 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
|
1580 log_palette->palVersion = 0x300; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1581 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
|
1582 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1583 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
|
1584 for (i = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1585 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
|
1586 i++, list = list->next) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1587 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
|
1588 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1589 new_palette = CreatePalette (log_palette); |
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 enter_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1592 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1593 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
|
1594 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
|
1595 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
|
1596 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1597 /* 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
|
1598 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
|
1599 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1600 leave_crit (); |
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 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1603 #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
|
1604 #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
|
1605 do \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1606 { \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1607 pe.peRed = GetRValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1608 pe.peGreen = GetGValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1609 pe.peBlue = GetBValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1610 pe.peFlags = 0; \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1611 } while (0) |
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 #if 0 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1614 /* 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
|
1615 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1616 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
|
1617 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1618 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
|
1619 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1620 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
|
1621 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1622 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1623 /* 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
|
1624 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1625 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1626 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
|
1627 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1628 ++list->refcount; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1629 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1630 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1631 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1632 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1633 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1634 /* 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
|
1635 list = (struct w32_palette_entry *) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1636 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
|
1637 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
|
1638 list->refcount = 1; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1639 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
|
1640 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
|
1641 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
|
1642 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1643 /* 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
|
1644 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
|
1645 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1646 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1647 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1648 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
|
1649 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1650 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
|
1651 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
|
1652 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1653 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
|
1654 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1655 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1656 /* 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
|
1657 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1658 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1659 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
|
1660 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1661 if (--list->refcount == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1662 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1663 *prev = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1664 xfree (list); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1665 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
|
1666 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1667 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1668 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1669 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1670 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1671 prev = &list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1672 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1673 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1674 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1675 /* 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
|
1676 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
|
1677 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1678 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1679 |
13434 | 1680 /* Decide if color named COLOR is valid for the display associated with |
1681 the selected frame; if so, return the rgb values in COLOR_DEF. | |
1682 If ALLOC is nonzero, allocate a new colormap cell. */ | |
1683 | |
1684 int | |
1685 defined_color (f, color, color_def, alloc) | |
1686 FRAME_PTR f; | |
1687 char *color; | |
1688 COLORREF *color_def; | |
1689 int alloc; | |
1690 { | |
1691 register Lisp_Object tem; | |
14353 | 1692 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1693 tem = x_to_w32_color (color); |
14353 | 1694 |
13434 | 1695 if (!NILP (tem)) |
1696 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1697 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
|
1698 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1699 struct w32_palette_entry * entry = |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1700 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
|
1701 struct w32_palette_entry ** prev = |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1702 &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
|
1703 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1704 /* 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
|
1705 while (entry) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1706 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1707 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
|
1708 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1709 prev = &entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1710 entry = entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1711 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1712 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1713 if (entry == NULL && alloc) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1714 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1715 /* 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
|
1716 entry = (struct w32_palette_entry *) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1717 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
|
1718 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
|
1719 entry->next = NULL; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1720 *prev = entry; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1721 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
|
1722 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1723 /* 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
|
1724 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
|
1725 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1726 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1727 /* 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
|
1728 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
|
1729 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
|
1730 *color_def = XUINT (tem) | 0x2000000; |
13434 | 1731 return 1; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1732 } |
13434 | 1733 else |
14353 | 1734 { |
1735 return 0; | |
1736 } | |
13434 | 1737 } |
1738 | |
1739 /* Given a string ARG naming a color, compute a pixel value from it | |
1740 suitable for screen F. | |
1741 If F is not a color screen, return DEF (default) regardless of what | |
1742 ARG says. */ | |
1743 | |
1744 int | |
1745 x_decode_color (f, arg, def) | |
1746 FRAME_PTR f; | |
1747 Lisp_Object arg; | |
1748 int def; | |
1749 { | |
1750 COLORREF cdef; | |
1751 | |
1752 CHECK_STRING (arg, 0); | |
1753 | |
1754 if (strcmp (XSTRING (arg)->data, "black") == 0) | |
1755 return BLACK_PIX_DEFAULT (f); | |
1756 else if (strcmp (XSTRING (arg)->data, "white") == 0) | |
1757 return WHITE_PIX_DEFAULT (f); | |
1758 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1759 if ((FRAME_W32_DISPLAY_INFO (f)->n_planes * FRAME_W32_DISPLAY_INFO (f)->n_cbits) == 1) |
13434 | 1760 return def; |
1761 | |
1762 /* defined_color is responsible for coping with failures | |
1763 by looking for a near-miss. */ | |
1764 if (defined_color (f, XSTRING (arg)->data, &cdef, 1)) | |
1765 return cdef; | |
1766 | |
1767 /* defined_color failed; return an ultimate default. */ | |
1768 return def; | |
1769 } | |
1770 | |
1771 /* Functions called only from `x_set_frame_param' | |
1772 to set individual parameters. | |
1773 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1774 If FRAME_W32_WINDOW (f) is 0, |
13434 | 1775 the frame is being created and its window does not exist yet. |
1776 In that case, just record the parameter's new value | |
1777 in the standard place; do not attempt to change the window. */ | |
1778 | |
1779 void | |
1780 x_set_foreground_color (f, arg, oldval) | |
1781 struct frame *f; | |
1782 Lisp_Object arg, oldval; | |
1783 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1784 f->output_data.w32->foreground_pixel |
13434 | 1785 = 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
|
1786 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1787 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 1788 { |
1789 recompute_basic_faces (f); | |
1790 if (FRAME_VISIBLE_P (f)) | |
1791 redraw_frame (f); | |
1792 } | |
1793 } | |
1794 | |
1795 void | |
1796 x_set_background_color (f, arg, oldval) | |
1797 struct frame *f; | |
1798 Lisp_Object arg, oldval; | |
1799 { | |
1800 Pixmap temp; | |
1801 int mask; | |
1802 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1803 f->output_data.w32->background_pixel |
13434 | 1804 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); |
1805 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1806 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 1807 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1808 SetWindowLong (FRAME_W32_WINDOW (f), WND_BACKGROUND_INDEX, f->output_data.w32->background_pixel); |
13434 | 1809 |
1810 recompute_basic_faces (f); | |
1811 | |
1812 if (FRAME_VISIBLE_P (f)) | |
1813 redraw_frame (f); | |
1814 } | |
1815 } | |
1816 | |
1817 void | |
1818 x_set_mouse_color (f, arg, oldval) | |
1819 struct frame *f; | |
1820 Lisp_Object arg, oldval; | |
1821 { | |
1822 #if 0 | |
1823 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
|
1824 #endif |
17632
d2915156a803
(x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents:
16884
diff
changeset
|
1825 int count; |
13434 | 1826 int mask_color; |
1827 | |
1828 if (!EQ (Qnil, arg)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1829 f->output_data.w32->mouse_pixel |
13434 | 1830 = 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
|
1831 mask_color = f->output_data.w32->background_pixel; |
13434 | 1832 /* No invisible pointers. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1833 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
|
1834 && 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
|
1835 f->output_data.w32->mouse_pixel = f->output_data.w32->foreground_pixel; |
13434 | 1836 |
1837 #if 0 | |
1838 BLOCK_INPUT; | |
1839 | |
1840 /* 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
|
1841 count = x_catch_errors (FRAME_W32_DISPLAY (f)); |
13434 | 1842 |
1843 if (!EQ (Qnil, Vx_pointer_shape)) | |
1844 { | |
1845 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
|
1846 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape)); |
13434 | 1847 } |
1848 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1849 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
|
1850 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s"); |
13434 | 1851 |
1852 if (!EQ (Qnil, Vx_nontext_pointer_shape)) | |
1853 { | |
1854 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
|
1855 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 1856 XINT (Vx_nontext_pointer_shape)); |
1857 } | |
1858 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1859 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
|
1860 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); |
13434 | 1861 |
1862 if (!EQ (Qnil, Vx_mode_pointer_shape)) | |
1863 { | |
1864 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
|
1865 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 1866 XINT (Vx_mode_pointer_shape)); |
1867 } | |
1868 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1869 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
|
1870 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s"); |
13434 | 1871 |
1872 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape)) | |
1873 { | |
1874 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0); | |
1875 cross_cursor | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1876 = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 1877 XINT (Vx_sensitive_text_pointer_shape)); |
1878 } | |
1879 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1880 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair); |
13434 | 1881 |
1882 /* 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
|
1883 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
|
1884 x_uncatch_errors (FRAME_W32_DISPLAY (f), count); |
13434 | 1885 |
1886 { | |
1887 XColor fore_color, back_color; | |
1888 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1889 fore_color.pixel = f->output_data.w32->mouse_pixel; |
13434 | 1890 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
|
1891 XQueryColor (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1892 DefaultColormap (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1893 DefaultScreen (FRAME_W32_DISPLAY (f))), |
13434 | 1894 &fore_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1895 XQueryColor (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1896 DefaultColormap (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1897 DefaultScreen (FRAME_W32_DISPLAY (f))), |
13434 | 1898 &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1899 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor, |
13434 | 1900 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1901 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor, |
13434 | 1902 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1903 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor, |
13434 | 1904 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1905 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor, |
13434 | 1906 &fore_color, &back_color); |
1907 } | |
1908 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1909 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 1910 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1911 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor); |
13434 | 1912 } |
1913 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1914 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
|
1915 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
|
1916 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
|
1917 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1918 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
|
1919 && 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
|
1920 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
|
1921 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
|
1922 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1923 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
|
1924 && 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
|
1925 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
|
1926 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
|
1927 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
|
1928 && 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
|
1929 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
|
1930 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
|
1931 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1932 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 1933 UNBLOCK_INPUT; |
1934 #endif | |
1935 } | |
1936 | |
1937 void | |
1938 x_set_cursor_color (f, arg, oldval) | |
1939 struct frame *f; | |
1940 Lisp_Object arg, oldval; | |
1941 { | |
1942 unsigned long fore_pixel; | |
1943 | |
1944 if (!EQ (Vx_cursor_fore_pixel, Qnil)) | |
1945 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, | |
1946 WHITE_PIX_DEFAULT (f)); | |
1947 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1948 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
|
1949 f->output_data.w32->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
13434 | 1950 |
1951 /* 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
|
1952 if (f->output_data.w32->cursor_pixel == f->output_data.w32->background_pixel) |
13434 | 1953 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1954 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
|
1955 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
|
1956 fore_pixel = f->output_data.w32->background_pixel; |
13434 | 1957 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1958 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
|
1959 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1960 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 1961 { |
1962 if (FRAME_VISIBLE_P (f)) | |
1963 { | |
1964 x_display_cursor (f, 0); | |
1965 x_display_cursor (f, 1); | |
1966 } | |
1967 } | |
1968 } | |
1969 | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1970 /* Set the border-color of frame F to pixel value PIX. |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1971 Note that this does not fully take effect if done before |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1972 F has an window. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1973 void |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1974 x_set_border_pixel (f, pix) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1975 struct frame *f; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1976 int pix; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1977 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1978 f->output_data.w32->border_pixel = pix; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1979 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1980 if (FRAME_W32_WINDOW (f) != 0 && f->output_data.w32->border_width > 0) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1981 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1982 if (FRAME_VISIBLE_P (f)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1983 redraw_frame (f); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1984 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1985 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
1986 |
13434 | 1987 /* Set the border-color of frame F to value described by ARG. |
1988 ARG can be a string naming a color. | |
1989 The border-color is used for the border that is drawn by the server. | |
1990 Note that this does not fully take effect if done before | |
1991 F has a window; it must be redone when the window is created. */ | |
1992 | |
1993 void | |
1994 x_set_border_color (f, arg, oldval) | |
1995 struct frame *f; | |
1996 Lisp_Object arg, oldval; | |
1997 { | |
1998 unsigned char *str; | |
1999 int pix; | |
2000 | |
2001 CHECK_STRING (arg, 0); | |
2002 str = XSTRING (arg)->data; | |
2003 | |
2004 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | |
2005 | |
2006 x_set_border_pixel (f, pix); | |
2007 } | |
2008 | |
2009 void | |
2010 x_set_cursor_type (f, arg, oldval) | |
2011 FRAME_PTR f; | |
2012 Lisp_Object arg, oldval; | |
2013 { | |
2014 if (EQ (arg, Qbar)) | |
2015 { | |
2016 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
|
2017 f->output_data.w32->cursor_width = 2; |
13434 | 2018 } |
2019 else if (CONSP (arg) && EQ (XCONS (arg)->car, Qbar) | |
2020 && INTEGERP (XCONS (arg)->cdr)) | |
2021 { | |
2022 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
|
2023 f->output_data.w32->cursor_width = XINT (XCONS (arg)->cdr); |
13434 | 2024 } |
2025 else | |
2026 /* Treat anything unknown as "box cursor". | |
2027 It was bad to signal an error; people have trouble fixing | |
2028 .Xdefaults with Emacs, when it has something bad in it. */ | |
2029 FRAME_DESIRED_CURSOR (f) = filled_box_cursor; | |
2030 | |
2031 /* Make sure the cursor gets redrawn. This is overkill, but how | |
2032 often do people change cursor types? */ | |
2033 update_mode_lines++; | |
2034 } | |
2035 | |
2036 void | |
2037 x_set_icon_type (f, arg, oldval) | |
2038 struct frame *f; | |
2039 Lisp_Object arg, oldval; | |
2040 { | |
2041 #if 0 | |
2042 Lisp_Object tem; | |
2043 int result; | |
2044 | |
2045 if (STRINGP (arg)) | |
2046 { | |
2047 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
2048 return; | |
2049 } | |
2050 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
2051 return; | |
2052 | |
2053 BLOCK_INPUT; | |
2054 if (NILP (arg)) | |
2055 result = x_text_icon (f, | |
2056 (char *) XSTRING ((!NILP (f->icon_name) | |
2057 ? f->icon_name | |
2058 : f->name))->data); | |
2059 else | |
2060 result = x_bitmap_icon (f, arg); | |
2061 | |
2062 if (result) | |
2063 { | |
2064 UNBLOCK_INPUT; | |
2065 error ("No icon window available"); | |
2066 } | |
2067 | |
2068 /* If the window was unmapped (and its icon was mapped), | |
2069 the new icon is not mapped, so map the window in its stead. */ | |
2070 if (FRAME_VISIBLE_P (f)) | |
2071 { | |
2072 #ifdef USE_X_TOOLKIT | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2073 XtPopup (f->output_data.w32->widget, XtGrabNone); |
13434 | 2074 #endif |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2075 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f)); |
13434 | 2076 } |
2077 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2078 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 2079 UNBLOCK_INPUT; |
2080 #endif | |
2081 } | |
2082 | |
2083 /* Return non-nil if frame F wants a bitmap icon. */ | |
2084 | |
2085 Lisp_Object | |
2086 x_icon_type (f) | |
2087 FRAME_PTR f; | |
2088 { | |
2089 Lisp_Object tem; | |
2090 | |
2091 tem = assq_no_quit (Qicon_type, f->param_alist); | |
2092 if (CONSP (tem)) | |
2093 return XCONS (tem)->cdr; | |
2094 else | |
2095 return Qnil; | |
2096 } | |
2097 | |
2098 void | |
2099 x_set_icon_name (f, arg, oldval) | |
2100 struct frame *f; | |
2101 Lisp_Object arg, oldval; | |
2102 { | |
2103 Lisp_Object tem; | |
2104 int result; | |
2105 | |
2106 if (STRINGP (arg)) | |
2107 { | |
2108 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
2109 return; | |
2110 } | |
2111 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
2112 return; | |
2113 | |
2114 f->icon_name = arg; | |
2115 | |
2116 #if 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2117 if (f->output_data.w32->icon_bitmap != 0) |
13434 | 2118 return; |
2119 | |
2120 BLOCK_INPUT; | |
2121 | |
2122 result = x_text_icon (f, | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2123 (char *) XSTRING ((!NILP (f->icon_name) |
13434 | 2124 ? f->icon_name |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2125 : !NILP (f->title) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2126 ? f->title |
13434 | 2127 : f->name))->data); |
2128 | |
2129 if (result) | |
2130 { | |
2131 UNBLOCK_INPUT; | |
2132 error ("No icon window available"); | |
2133 } | |
2134 | |
2135 /* If the window was unmapped (and its icon was mapped), | |
2136 the new icon is not mapped, so map the window in its stead. */ | |
2137 if (FRAME_VISIBLE_P (f)) | |
2138 { | |
2139 #ifdef USE_X_TOOLKIT | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2140 XtPopup (f->output_data.w32->widget, XtGrabNone); |
13434 | 2141 #endif |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2142 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f)); |
13434 | 2143 } |
2144 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2145 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 2146 UNBLOCK_INPUT; |
2147 #endif | |
2148 } | |
2149 | |
2150 extern Lisp_Object x_new_font (); | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2151 extern Lisp_Object x_new_fontset(); |
13434 | 2152 |
2153 void | |
2154 x_set_font (f, arg, oldval) | |
2155 struct frame *f; | |
2156 Lisp_Object arg, oldval; | |
2157 { | |
2158 Lisp_Object result; | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2159 Lisp_Object fontset_name; |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
2160 Lisp_Object frame; |
13434 | 2161 |
2162 CHECK_STRING (arg, 1); | |
2163 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2164 fontset_name = Fquery_fontset (arg, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2165 |
13434 | 2166 BLOCK_INPUT; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2167 result = (STRINGP (fontset_name) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2168 ? x_new_fontset (f, XSTRING (fontset_name)->data) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2169 : x_new_font (f, XSTRING (arg)->data)); |
13434 | 2170 UNBLOCK_INPUT; |
2171 | |
2172 if (EQ (result, Qnil)) | |
2173 error ("Font \"%s\" is not defined", XSTRING (arg)->data); | |
2174 else if (EQ (result, Qt)) | |
2175 error ("the characters of the given font have varying widths"); | |
2176 else if (STRINGP (result)) | |
2177 { | |
2178 recompute_basic_faces (f); | |
2179 store_frame_param (f, Qfont, result); | |
2180 } | |
2181 else | |
2182 abort (); | |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
2183 |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
2184 XSETFRAME (frame, f); |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
2185 call1 (Qface_set_after_frame_default, frame); |
13434 | 2186 } |
2187 | |
2188 void | |
2189 x_set_border_width (f, arg, oldval) | |
2190 struct frame *f; | |
2191 Lisp_Object arg, oldval; | |
2192 { | |
2193 CHECK_NUMBER (arg, 0); | |
2194 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2195 if (XINT (arg) == f->output_data.w32->border_width) |
13434 | 2196 return; |
2197 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2198 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2199 error ("Cannot change the border width of a window"); |
2200 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2201 f->output_data.w32->border_width = XINT (arg); |
13434 | 2202 } |
2203 | |
2204 void | |
2205 x_set_internal_border_width (f, arg, oldval) | |
2206 struct frame *f; | |
2207 Lisp_Object arg, oldval; | |
2208 { | |
2209 int mask; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2210 int old = f->output_data.w32->internal_border_width; |
13434 | 2211 |
2212 CHECK_NUMBER (arg, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2213 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
|
2214 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
|
2215 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
|
2216 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2217 if (f->output_data.w32->internal_border_width == old) |
13434 | 2218 return; |
2219 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2220 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2221 { |
2222 BLOCK_INPUT; | |
2223 x_set_window_size (f, 0, f->width, f->height); | |
2224 UNBLOCK_INPUT; | |
2225 SET_FRAME_GARBAGED (f); | |
2226 } | |
2227 } | |
2228 | |
2229 void | |
2230 x_set_visibility (f, value, oldval) | |
2231 struct frame *f; | |
2232 Lisp_Object value, oldval; | |
2233 { | |
2234 Lisp_Object frame; | |
2235 XSETFRAME (frame, f); | |
2236 | |
2237 if (NILP (value)) | |
2238 Fmake_frame_invisible (frame, Qt); | |
2239 else if (EQ (value, Qicon)) | |
2240 Ficonify_frame (frame); | |
2241 else | |
2242 Fmake_frame_visible (frame); | |
2243 } | |
2244 | |
2245 void | |
2246 x_set_menu_bar_lines (f, value, oldval) | |
2247 struct frame *f; | |
2248 Lisp_Object value, oldval; | |
2249 { | |
2250 int nlines; | |
2251 int olines = FRAME_MENU_BAR_LINES (f); | |
2252 | |
2253 /* Right now, menu bars don't work properly in minibuf-only frames; | |
2254 most of the commands try to apply themselves to the minibuffer | |
2255 frame itslef, and get an error because you can't switch buffers | |
2256 in or split the minibuffer window. */ | |
2257 if (FRAME_MINIBUF_ONLY_P (f)) | |
2258 return; | |
2259 | |
2260 if (INTEGERP (value)) | |
2261 nlines = XINT (value); | |
2262 else | |
2263 nlines = 0; | |
2264 | |
2265 FRAME_MENU_BAR_LINES (f) = 0; | |
2266 if (nlines) | |
2267 FRAME_EXTERNAL_MENU_BAR (f) = 1; | |
2268 else | |
2269 { | |
2270 if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | |
2271 free_frame_menubar (f); | |
2272 FRAME_EXTERNAL_MENU_BAR (f) = 0; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2273 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2274 /* 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
|
2275 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
|
2276 set correctly. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2277 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
13434 | 2278 } |
2279 } | |
2280 | |
2281 /* 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
|
2282 w32_id_name. |
13434 | 2283 |
2284 If EXPLICIT is non-zero, that indicates that lisp code is setting the | |
2285 name; if NAME is a string, set F's name to NAME and set | |
2286 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. | |
2287 | |
2288 If EXPLICIT is zero, that indicates that Emacs redisplay code is | |
2289 suggesting a new name, which lisp code should override; if | |
2290 F->explicit_name is set, ignore the new name; otherwise, set it. */ | |
2291 | |
2292 void | |
2293 x_set_name (f, name, explicit) | |
2294 struct frame *f; | |
2295 Lisp_Object name; | |
2296 int explicit; | |
2297 { | |
2298 /* Make sure that requests from lisp code override requests from | |
2299 Emacs redisplay code. */ | |
2300 if (explicit) | |
2301 { | |
2302 /* If we're switching from explicit to implicit, we had better | |
2303 update the mode lines and thereby update the title. */ | |
2304 if (f->explicit_name && NILP (name)) | |
2305 update_mode_lines = 1; | |
2306 | |
2307 f->explicit_name = ! NILP (name); | |
2308 } | |
2309 else if (f->explicit_name) | |
2310 return; | |
2311 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2312 /* If NAME is nil, set the name to the w32_id_name. */ |
13434 | 2313 if (NILP (name)) |
2314 { | |
2315 /* Check for no change needed in this very common case | |
2316 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
|
2317 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name, |
13434 | 2318 XSTRING (f->name)->data)) |
2319 return; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2320 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name); |
13434 | 2321 } |
2322 else | |
2323 CHECK_STRING (name, 0); | |
2324 | |
2325 /* Don't change the name if it's already NAME. */ | |
2326 if (! NILP (Fstring_equal (name, f->name))) | |
2327 return; | |
2328 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2329 f->name = name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2330 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2331 /* 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
|
2332 the name parameter. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2333 if (! NILP (f->title)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2334 name = f->title; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2335 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2336 if (FRAME_W32_WINDOW (f)) |
13434 | 2337 { |
2338 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2339 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); |
13434 | 2340 UNBLOCK_INPUT; |
2341 } | |
2342 } | |
2343 | |
2344 /* This function should be called when the user's lisp code has | |
2345 specified a name for the frame; the name will override any set by the | |
2346 redisplay code. */ | |
2347 void | |
2348 x_explicitly_set_name (f, arg, oldval) | |
2349 FRAME_PTR f; | |
2350 Lisp_Object arg, oldval; | |
2351 { | |
2352 x_set_name (f, arg, 1); | |
2353 } | |
2354 | |
2355 /* This function should be called by Emacs redisplay code to set the | |
2356 name; names set this way will never override names set by the user's | |
2357 lisp code. */ | |
2358 void | |
2359 x_implicitly_set_name (f, arg, oldval) | |
2360 FRAME_PTR f; | |
2361 Lisp_Object arg, oldval; | |
2362 { | |
2363 x_set_name (f, arg, 0); | |
2364 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2365 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2366 /* 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
|
2367 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
|
2368 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2369 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
|
2370 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
|
2371 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
|
2372 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2373 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
|
2374 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
|
2375 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
|
2376 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2377 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2378 x_set_title (f, name) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2379 struct frame *f; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2380 Lisp_Object name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2381 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2382 /* 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
|
2383 if (EQ (name, f->title)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2384 return; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2385 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2386 update_mode_lines = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2387 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2388 f->title = name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2389 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2390 if (NILP (name)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2391 name = f->name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2392 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2393 if (FRAME_W32_WINDOW (f)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2394 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2395 BLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2396 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
|
2397 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2398 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2399 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2400 |
13434 | 2401 void |
2402 x_set_autoraise (f, arg, oldval) | |
2403 struct frame *f; | |
2404 Lisp_Object arg, oldval; | |
2405 { | |
2406 f->auto_raise = !EQ (Qnil, arg); | |
2407 } | |
2408 | |
2409 void | |
2410 x_set_autolower (f, arg, oldval) | |
2411 struct frame *f; | |
2412 Lisp_Object arg, oldval; | |
2413 { | |
2414 f->auto_lower = !EQ (Qnil, arg); | |
2415 } | |
2416 | |
2417 void | |
2418 x_set_unsplittable (f, arg, oldval) | |
2419 struct frame *f; | |
2420 Lisp_Object arg, oldval; | |
2421 { | |
2422 f->no_split = !NILP (arg); | |
2423 } | |
2424 | |
2425 void | |
2426 x_set_vertical_scroll_bars (f, arg, oldval) | |
2427 struct frame *f; | |
2428 Lisp_Object arg, oldval; | |
2429 { | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2430 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
|
2431 || (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
|
2432 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2433 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f))) |
13434 | 2434 { |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2435 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ? |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2436 vertical_scroll_bar_none : |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2437 /* Put scroll bars on the right by default, as is conventional |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2438 on MS-Windows. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2439 EQ (Qleft, arg) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2440 ? vertical_scroll_bar_left |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2441 : vertical_scroll_bar_right; |
13434 | 2442 |
2443 /* We set this parameter before creating the window for the | |
2444 frame, so we can get the geometry right from the start. | |
2445 However, if the window hasn't been created yet, we shouldn't | |
2446 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
|
2447 if (FRAME_W32_WINDOW (f)) |
13434 | 2448 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
2449 } | |
2450 } | |
2451 | |
2452 void | |
2453 x_set_scroll_bar_width (f, arg, oldval) | |
2454 struct frame *f; | |
2455 Lisp_Object arg, oldval; | |
2456 { | |
2457 if (NILP (arg)) | |
2458 { | |
2459 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0; | |
2460 FRAME_SCROLL_BAR_COLS (f) = 2; | |
2461 } | |
2462 else if (INTEGERP (arg) && XINT (arg) > 0 | |
2463 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f)) | |
2464 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2465 int wid = FONT_WIDTH (f->output_data.w32->font); |
13434 | 2466 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg); |
2467 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
|
2468 if (FRAME_W32_WINDOW (f)) |
13434 | 2469 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
2470 } | |
2471 } | |
2472 | |
2473 /* Subroutines of creating an frame. */ | |
2474 | |
2475 /* Make sure that Vx_resource_name is set to a reasonable value. | |
2476 Fix it up, or set it to `emacs' if it is too hopeless. */ | |
2477 | |
2478 static void | |
2479 validate_x_resource_name () | |
2480 { | |
2481 int len; | |
2482 /* Number of valid characters in the resource name. */ | |
2483 int good_count = 0; | |
2484 /* Number of invalid characters in the resource name. */ | |
2485 int bad_count = 0; | |
2486 Lisp_Object new; | |
2487 int i; | |
2488 | |
2489 if (STRINGP (Vx_resource_name)) | |
2490 { | |
2491 unsigned char *p = XSTRING (Vx_resource_name)->data; | |
2492 int i; | |
2493 | |
2494 len = XSTRING (Vx_resource_name)->size; | |
2495 | |
2496 /* Only letters, digits, - and _ are valid in resource names. | |
2497 Count the valid characters and count the invalid ones. */ | |
2498 for (i = 0; i < len; i++) | |
2499 { | |
2500 int c = p[i]; | |
2501 if (! ((c >= 'a' && c <= 'z') | |
2502 || (c >= 'A' && c <= 'Z') | |
2503 || (c >= '0' && c <= '9') | |
2504 || c == '-' || c == '_')) | |
2505 bad_count++; | |
2506 else | |
2507 good_count++; | |
2508 } | |
2509 } | |
2510 else | |
2511 /* Not a string => completely invalid. */ | |
2512 bad_count = 5, good_count = 0; | |
2513 | |
2514 /* If name is valid already, return. */ | |
2515 if (bad_count == 0) | |
2516 return; | |
2517 | |
2518 /* If name is entirely invalid, or nearly so, use `emacs'. */ | |
2519 if (good_count == 0 | |
2520 || (good_count == 1 && bad_count > 0)) | |
2521 { | |
2522 Vx_resource_name = build_string ("emacs"); | |
2523 return; | |
2524 } | |
2525 | |
2526 /* Name is partly valid. Copy it and replace the invalid characters | |
2527 with underscores. */ | |
2528 | |
2529 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name); | |
2530 | |
2531 for (i = 0; i < len; i++) | |
2532 { | |
2533 int c = XSTRING (new)->data[i]; | |
2534 if (! ((c >= 'a' && c <= 'z') | |
2535 || (c >= 'A' && c <= 'Z') | |
2536 || (c >= '0' && c <= '9') | |
2537 || c == '-' || c == '_')) | |
2538 XSTRING (new)->data[i] = '_'; | |
2539 } | |
2540 } | |
2541 | |
2542 | |
2543 extern char *x_get_string_resource (); | |
2544 | |
2545 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0, | |
2546 "Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.\n\ | |
2547 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the\n\ | |
2548 class, where INSTANCE is the name under which Emacs was invoked, or\n\ | |
2549 the name specified by the `-name' or `-rn' command-line arguments.\n\ | |
2550 \n\ | |
2551 The optional arguments COMPONENT and SUBCLASS add to the key and the\n\ | |
2552 class, respectively. You must specify both of them or neither.\n\ | |
2553 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\ | |
2554 and the class is `Emacs.CLASS.SUBCLASS'.") | |
2555 (attribute, class, component, subclass) | |
2556 Lisp_Object attribute, class, component, subclass; | |
2557 { | |
2558 register char *value; | |
2559 char *name_key; | |
2560 char *class_key; | |
2561 | |
2562 CHECK_STRING (attribute, 0); | |
2563 CHECK_STRING (class, 0); | |
2564 | |
2565 if (!NILP (component)) | |
2566 CHECK_STRING (component, 1); | |
2567 if (!NILP (subclass)) | |
2568 CHECK_STRING (subclass, 2); | |
2569 if (NILP (component) != NILP (subclass)) | |
2570 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | |
2571 | |
2572 validate_x_resource_name (); | |
2573 | |
2574 /* Allocate space for the components, the dots which separate them, | |
2575 and the final '\0'. Make them big enough for the worst case. */ | |
2576 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size | |
2577 + (STRINGP (component) | |
2578 ? XSTRING (component)->size : 0) | |
2579 + XSTRING (attribute)->size | |
2580 + 3); | |
2581 | |
2582 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
2583 + XSTRING (class)->size | |
2584 + (STRINGP (subclass) | |
2585 ? XSTRING (subclass)->size : 0) | |
2586 + 3); | |
2587 | |
2588 /* Start with emacs.FRAMENAME for the name (the specific one) | |
2589 and with `Emacs' for the class key (the general one). */ | |
2590 strcpy (name_key, XSTRING (Vx_resource_name)->data); | |
2591 strcpy (class_key, EMACS_CLASS); | |
2592 | |
2593 strcat (class_key, "."); | |
2594 strcat (class_key, XSTRING (class)->data); | |
2595 | |
2596 if (!NILP (component)) | |
2597 { | |
2598 strcat (class_key, "."); | |
2599 strcat (class_key, XSTRING (subclass)->data); | |
2600 | |
2601 strcat (name_key, "."); | |
2602 strcat (name_key, XSTRING (component)->data); | |
2603 } | |
2604 | |
2605 strcat (name_key, "."); | |
2606 strcat (name_key, XSTRING (attribute)->data); | |
2607 | |
2608 value = x_get_string_resource (Qnil, | |
2609 name_key, class_key); | |
2610 | |
2611 if (value != (char *) 0) | |
2612 return build_string (value); | |
2613 else | |
2614 return Qnil; | |
2615 } | |
2616 | |
2617 /* Used when C code wants a resource value. */ | |
2618 | |
2619 char * | |
2620 x_get_resource_string (attribute, class) | |
2621 char *attribute, *class; | |
2622 { | |
2623 register char *value; | |
2624 char *name_key; | |
2625 char *class_key; | |
2626 | |
2627 /* Allocate space for the components, the dots which separate them, | |
2628 and the final '\0'. */ | |
2629 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size | |
2630 + strlen (attribute) + 2); | |
2631 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
2632 + strlen (class) + 2); | |
2633 | |
2634 sprintf (name_key, "%s.%s", | |
2635 XSTRING (Vinvocation_name)->data, | |
2636 attribute); | |
2637 sprintf (class_key, "%s.%s", EMACS_CLASS, class); | |
2638 | |
2639 return x_get_string_resource (selected_frame, | |
2640 name_key, class_key); | |
2641 } | |
2642 | |
2643 /* Types we might convert a resource string into. */ | |
2644 enum resource_types | |
2645 { | |
2646 number, boolean, string, symbol | |
2647 }; | |
2648 | |
2649 /* Return the value of parameter PARAM. | |
2650 | |
2651 First search ALIST, then Vdefault_frame_alist, then the X defaults | |
2652 database, using ATTRIBUTE as the attribute name and CLASS as its class. | |
2653 | |
2654 Convert the resource to the type specified by desired_type. | |
2655 | |
2656 If no default is specified, return Qunbound. If you call | |
2657 x_get_arg, make sure you deal with Qunbound in a reasonable way, | |
2658 and don't let it get stored in any Lisp-visible variables! */ | |
2659 | |
2660 static Lisp_Object | |
2661 x_get_arg (alist, param, attribute, class, type) | |
2662 Lisp_Object alist, param; | |
2663 char *attribute; | |
2664 char *class; | |
2665 enum resource_types type; | |
2666 { | |
2667 register Lisp_Object tem; | |
2668 | |
2669 tem = Fassq (param, alist); | |
2670 if (EQ (tem, Qnil)) | |
2671 tem = Fassq (param, Vdefault_frame_alist); | |
2672 if (EQ (tem, Qnil)) | |
2673 { | |
2674 | |
2675 if (attribute) | |
2676 { | |
2677 tem = Fx_get_resource (build_string (attribute), | |
2678 build_string (class), | |
2679 Qnil, Qnil); | |
2680 | |
2681 if (NILP (tem)) | |
2682 return Qunbound; | |
2683 | |
2684 switch (type) | |
2685 { | |
2686 case number: | |
2687 return make_number (atoi (XSTRING (tem)->data)); | |
2688 | |
2689 case boolean: | |
2690 tem = Fdowncase (tem); | |
2691 if (!strcmp (XSTRING (tem)->data, "on") | |
2692 || !strcmp (XSTRING (tem)->data, "true")) | |
2693 return Qt; | |
2694 else | |
2695 return Qnil; | |
2696 | |
2697 case string: | |
2698 return tem; | |
2699 | |
2700 case symbol: | |
2701 /* As a special case, we map the values `true' and `on' | |
2702 to Qt, and `false' and `off' to Qnil. */ | |
2703 { | |
2704 Lisp_Object lower; | |
2705 lower = Fdowncase (tem); | |
2706 if (!strcmp (XSTRING (lower)->data, "on") | |
2707 || !strcmp (XSTRING (lower)->data, "true")) | |
2708 return Qt; | |
2709 else if (!strcmp (XSTRING (lower)->data, "off") | |
2710 || !strcmp (XSTRING (lower)->data, "false")) | |
2711 return Qnil; | |
2712 else | |
2713 return Fintern (tem, Qnil); | |
2714 } | |
2715 | |
2716 default: | |
2717 abort (); | |
2718 } | |
2719 } | |
2720 else | |
2721 return Qunbound; | |
2722 } | |
2723 return Fcdr (tem); | |
2724 } | |
2725 | |
2726 /* Record in frame F the specified or default value according to ALIST | |
2727 of the parameter named PARAM (a Lisp symbol). | |
2728 If no value is specified for PARAM, look for an X default for XPROP | |
2729 on the frame named NAME. | |
2730 If that is not found either, use the value DEFLT. */ | |
2731 | |
2732 static Lisp_Object | |
2733 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) | |
2734 struct frame *f; | |
2735 Lisp_Object alist; | |
2736 Lisp_Object prop; | |
2737 Lisp_Object deflt; | |
2738 char *xprop; | |
2739 char *xclass; | |
2740 enum resource_types type; | |
2741 { | |
2742 Lisp_Object tem; | |
2743 | |
2744 tem = x_get_arg (alist, prop, xprop, xclass, type); | |
2745 if (EQ (tem, Qunbound)) | |
2746 tem = deflt; | |
2747 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); | |
2748 return tem; | |
2749 } | |
2750 | |
2751 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0, | |
2752 "Parse an X-style geometry string STRING.\n\ | |
2753 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\ | |
2754 The properties returned may include `top', `left', `height', and `width'.\n\ | |
2755 The value of `left' or `top' may be an integer,\n\ | |
2756 or a list (+ N) meaning N pixels relative to top/left corner,\n\ | |
2757 or a list (- N) meaning -N pixels relative to bottom/right corner.") | |
2758 (string) | |
2759 Lisp_Object string; | |
2760 { | |
2761 int geometry, x, y; | |
2762 unsigned int width, height; | |
2763 Lisp_Object result; | |
2764 | |
2765 CHECK_STRING (string, 0); | |
2766 | |
2767 geometry = XParseGeometry ((char *) XSTRING (string)->data, | |
2768 &x, &y, &width, &height); | |
2769 | |
2770 result = Qnil; | |
2771 if (geometry & XValue) | |
2772 { | |
2773 Lisp_Object element; | |
2774 | |
2775 if (x >= 0 && (geometry & XNegative)) | |
2776 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil))); | |
2777 else if (x < 0 && ! (geometry & XNegative)) | |
2778 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil))); | |
2779 else | |
2780 element = Fcons (Qleft, make_number (x)); | |
2781 result = Fcons (element, result); | |
2782 } | |
2783 | |
2784 if (geometry & YValue) | |
2785 { | |
2786 Lisp_Object element; | |
2787 | |
2788 if (y >= 0 && (geometry & YNegative)) | |
2789 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil))); | |
2790 else if (y < 0 && ! (geometry & YNegative)) | |
2791 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil))); | |
2792 else | |
2793 element = Fcons (Qtop, make_number (y)); | |
2794 result = Fcons (element, result); | |
2795 } | |
2796 | |
2797 if (geometry & WidthValue) | |
2798 result = Fcons (Fcons (Qwidth, make_number (width)), result); | |
2799 if (geometry & HeightValue) | |
2800 result = Fcons (Fcons (Qheight, make_number (height)), result); | |
2801 | |
2802 return result; | |
2803 } | |
2804 | |
2805 /* Calculate the desired size and position of this window, | |
2806 and return the flags saying which aspects were specified. | |
2807 | |
2808 This function does not make the coordinates positive. */ | |
2809 | |
2810 #define DEFAULT_ROWS 40 | |
2811 #define DEFAULT_COLS 80 | |
2812 | |
2813 static int | |
2814 x_figure_window_size (f, parms) | |
2815 struct frame *f; | |
2816 Lisp_Object parms; | |
2817 { | |
2818 register Lisp_Object tem0, tem1, tem2; | |
2819 int height, width, left, top; | |
2820 register int geometry; | |
2821 long window_prompting = 0; | |
2822 | |
2823 /* Default values if we fall through. | |
2824 Actually, if that happens we should get | |
2825 window manager prompting. */ | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2826 SET_FRAME_WIDTH (f, DEFAULT_COLS); |
13434 | 2827 f->height = DEFAULT_ROWS; |
2828 /* Window managers expect that if program-specified | |
2829 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
|
2830 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
|
2831 f->output_data.w32->left_pos = 0; |
13434 | 2832 |
2833 tem0 = x_get_arg (parms, Qheight, 0, 0, number); | |
2834 tem1 = x_get_arg (parms, Qwidth, 0, 0, number); | |
2835 tem2 = x_get_arg (parms, Quser_size, 0, 0, number); | |
2836 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | |
2837 { | |
2838 if (!EQ (tem0, Qunbound)) | |
2839 { | |
2840 CHECK_NUMBER (tem0, 0); | |
2841 f->height = XINT (tem0); | |
2842 } | |
2843 if (!EQ (tem1, Qunbound)) | |
2844 { | |
2845 CHECK_NUMBER (tem1, 0); | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2846 SET_FRAME_WIDTH (f, XINT (tem1)); |
13434 | 2847 } |
2848 if (!NILP (tem2) && !EQ (tem2, Qunbound)) | |
2849 window_prompting |= USSize; | |
2850 else | |
2851 window_prompting |= PSize; | |
2852 } | |
2853 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2854 f->output_data.w32->vertical_scroll_bar_extra |
13434 | 2855 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
2856 ? 0 | |
2857 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
2858 ? 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
|
2859 : (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
|
2860 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
|
2861 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); |
13434 | 2862 |
2863 tem0 = x_get_arg (parms, Qtop, 0, 0, number); | |
2864 tem1 = x_get_arg (parms, Qleft, 0, 0, number); | |
2865 tem2 = x_get_arg (parms, Quser_position, 0, 0, number); | |
2866 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) | |
2867 { | |
2868 if (EQ (tem0, Qminus)) | |
2869 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2870 f->output_data.w32->top_pos = 0; |
13434 | 2871 window_prompting |= YNegative; |
2872 } | |
2873 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus) | |
2874 && CONSP (XCONS (tem0)->cdr) | |
2875 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car)) | |
2876 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2877 f->output_data.w32->top_pos = - XINT (XCONS (XCONS (tem0)->cdr)->car); |
13434 | 2878 window_prompting |= YNegative; |
2879 } | |
2880 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus) | |
2881 && CONSP (XCONS (tem0)->cdr) | |
2882 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car)) | |
2883 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2884 f->output_data.w32->top_pos = XINT (XCONS (XCONS (tem0)->cdr)->car); |
13434 | 2885 } |
2886 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
|
2887 f->output_data.w32->top_pos = 0; |
13434 | 2888 else |
2889 { | |
2890 CHECK_NUMBER (tem0, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2891 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
|
2892 if (f->output_data.w32->top_pos < 0) |
13434 | 2893 window_prompting |= YNegative; |
2894 } | |
2895 | |
2896 if (EQ (tem1, Qminus)) | |
2897 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2898 f->output_data.w32->left_pos = 0; |
13434 | 2899 window_prompting |= XNegative; |
2900 } | |
2901 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus) | |
2902 && CONSP (XCONS (tem1)->cdr) | |
2903 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car)) | |
2904 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2905 f->output_data.w32->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car); |
13434 | 2906 window_prompting |= XNegative; |
2907 } | |
2908 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus) | |
2909 && CONSP (XCONS (tem1)->cdr) | |
2910 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car)) | |
2911 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2912 f->output_data.w32->left_pos = XINT (XCONS (XCONS (tem1)->cdr)->car); |
13434 | 2913 } |
2914 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
|
2915 f->output_data.w32->left_pos = 0; |
13434 | 2916 else |
2917 { | |
2918 CHECK_NUMBER (tem1, 0); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2919 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
|
2920 if (f->output_data.w32->left_pos < 0) |
13434 | 2921 window_prompting |= XNegative; |
2922 } | |
2923 | |
2924 if (!NILP (tem2) && ! EQ (tem2, Qunbound)) | |
2925 window_prompting |= USPosition; | |
2926 else | |
2927 window_prompting |= PPosition; | |
2928 } | |
2929 | |
2930 return window_prompting; | |
2931 } | |
2932 | |
2933 | |
2934 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2935 extern LRESULT CALLBACK w32_wnd_proc (); |
13434 | 2936 |
2937 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2938 w32_init_class (hinst) |
13434 | 2939 HINSTANCE hinst; |
2940 { | |
2941 WNDCLASS wc; | |
2942 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2943 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
|
2944 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc; |
13434 | 2945 wc.cbClsExtra = 0; |
2946 wc.cbWndExtra = WND_EXTRA_BYTES; | |
2947 wc.hInstance = hinst; | |
2948 wc.hIcon = LoadIcon (hinst, EMACS_CLASS); | |
2949 wc.hCursor = LoadCursor (NULL, IDC_ARROW); | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2950 wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */ |
13434 | 2951 wc.lpszMenuName = NULL; |
2952 wc.lpszClassName = EMACS_CLASS; | |
2953 | |
2954 return (RegisterClass (&wc)); | |
2955 } | |
2956 | |
2957 HWND | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2958 w32_createscrollbar (f, bar) |
13434 | 2959 struct frame *f; |
2960 struct scroll_bar * bar; | |
2961 { | |
2962 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, | |
2963 /* Position and size of scroll bar. */ | |
2964 XINT(bar->left), XINT(bar->top), | |
2965 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
|
2966 FRAME_W32_WINDOW (f), |
13434 | 2967 NULL, |
2968 hinst, | |
2969 NULL)); | |
2970 } | |
2971 | |
2972 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2973 w32_createwindow (f) |
13434 | 2974 struct frame *f; |
2975 { | |
2976 HWND hwnd; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2977 RECT rect; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2978 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2979 rect.left = rect.top = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2980 rect.right = PIXEL_WIDTH (f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2981 rect.bottom = PIXEL_HEIGHT (f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2982 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2983 AdjustWindowRect (&rect, f->output_data.w32->dwStyle, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2984 FRAME_EXTERNAL_MENU_BAR (f)); |
13434 | 2985 |
2986 /* Do first time app init */ | |
2987 | |
2988 if (!hprevinst) | |
2989 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2990 w32_init_class (hinst); |
13434 | 2991 } |
2992 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2993 FRAME_W32_WINDOW (f) = hwnd |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2994 = CreateWindow (EMACS_CLASS, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2995 f->namebuf, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2996 f->output_data.w32->dwStyle | WS_CLIPCHILDREN, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2997 f->output_data.w32->left_pos, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2998 f->output_data.w32->top_pos, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2999 rect.right - rect.left, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3000 rect.bottom - rect.top, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3001 NULL, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3002 NULL, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3003 hinst, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3004 NULL); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3005 |
13434 | 3006 if (hwnd) |
3007 { | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3008 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
|
3009 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
|
3010 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
|
3011 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
|
3012 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
|
3013 |
21884 | 3014 /* Enable drag-n-drop. */ |
3015 DragAcceptFiles (hwnd, TRUE); | |
3016 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3017 /* 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
|
3018 ShowWindow (hwnd, SW_HIDE); |
13434 | 3019 } |
3020 } | |
3021 | |
3022 void | |
3023 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
|
3024 W32Msg * wmsg; |
13434 | 3025 HWND hwnd; |
3026 UINT msg; | |
3027 WPARAM wParam; | |
3028 LPARAM lParam; | |
3029 { | |
3030 wmsg->msg.hwnd = hwnd; | |
3031 wmsg->msg.message = msg; | |
3032 wmsg->msg.wParam = wParam; | |
3033 wmsg->msg.lParam = lParam; | |
3034 wmsg->msg.time = GetMessageTime (); | |
3035 | |
3036 post_msg (wmsg); | |
3037 } | |
3038 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3039 /* 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
|
3040 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
|
3041 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
|
3042 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
|
3043 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
|
3044 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
|
3045 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
|
3046 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
|
3047 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
|
3048 on Swedish keyboards). */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3049 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3050 #define EMACS_LCONTROL 0 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3051 #define EMACS_RCONTROL 1 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3052 #define EMACS_LMENU 2 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3053 #define EMACS_RMENU 3 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3054 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3055 static int modifiers[4]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3056 static int modifiers_recorded; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3057 static int modifier_key_support_tested; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3058 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3059 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3060 test_modifier_support (unsigned int wparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3061 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3062 unsigned int l, r; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3063 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3064 if (wparam != VK_CONTROL && wparam != VK_MENU) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3065 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3066 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3067 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3068 l = VK_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3069 r = VK_RCONTROL; |
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 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3072 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3073 l = VK_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3074 r = VK_RMENU; |
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 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000)) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3077 modifiers_recorded = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3078 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3079 modifiers_recorded = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3080 modifier_key_support_tested = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3081 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3082 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3083 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3084 record_keydown (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3085 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3086 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3087 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3088 if (!modifier_key_support_tested) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3089 test_modifier_support (wparam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3090 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3091 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
|
3092 return; |
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 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3095 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3096 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3097 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3098 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3099 modifiers[i] = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3100 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3101 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3102 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3103 record_keyup (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3104 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3105 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3106 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3107 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
|
3108 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3109 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3110 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3111 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3112 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3113 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3114 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3115 modifiers[i] = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3116 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3117 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3118 /* 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
|
3119 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
|
3120 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
|
3121 static void |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3122 reset_modifiers () |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3123 { |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3124 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
|
3125 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3126 if (GetFocus () == NULL) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3127 /* Emacs doesn't have keyboard focus. Do nothing. */ |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3128 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
|
3129 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3130 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
|
3131 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
|
3132 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3133 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
|
3134 /* 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
|
3135 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
|
3136 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3137 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
|
3138 /* 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
|
3139 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
|
3140 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3141 /* Update the state of all modifier keys, because modifiers used in |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3142 hot-key combinations can get stuck on if Emacs loses focus as a |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3143 result of a hot-key being pressed. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3144 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3145 BYTE keystate[256]; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3146 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3147 #define CURRENT_STATE(key) ((GetAsyncKeyState (key) & 0x8000) >> 8) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3148 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3149 GetKeyboardState (keystate); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3150 keystate[VK_SHIFT] = CURRENT_STATE (VK_SHIFT); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3151 keystate[VK_CONTROL] = CURRENT_STATE (VK_CONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3152 keystate[VK_LCONTROL] = CURRENT_STATE (VK_LCONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3153 keystate[VK_RCONTROL] = CURRENT_STATE (VK_RCONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3154 keystate[VK_MENU] = CURRENT_STATE (VK_MENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3155 keystate[VK_LMENU] = CURRENT_STATE (VK_LMENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3156 keystate[VK_RMENU] = CURRENT_STATE (VK_RMENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3157 keystate[VK_LWIN] = CURRENT_STATE (VK_LWIN); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3158 keystate[VK_RWIN] = CURRENT_STATE (VK_RWIN); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3159 keystate[VK_APPS] = CURRENT_STATE (VK_APPS); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3160 SetKeyboardState (keystate); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3161 } |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3162 } |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3163 |
15377
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3164 /* 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
|
3165 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
|
3166 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
|
3167 the left or right modifier should be set. */ |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3168 static void |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3169 sync_modifiers () |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3170 { |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3171 if (!modifiers_recorded) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3172 return; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3173 |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3174 if (!(GetKeyState (VK_CONTROL) & 0x8000)) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3175 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3176 |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3177 if (!(GetKeyState (VK_MENU) & 0x8000)) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3178 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3179 } |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3180 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3181 static int |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3182 modifier_set (int vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3183 { |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3184 if (vkey == VK_CAPITAL || vkey == VK_SCROLL) |
15280
f39684fddaff
(modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents:
15232
diff
changeset
|
3185 return (GetKeyState (vkey) & 0x1); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3186 if (!modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3187 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3188 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3189 switch (vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3190 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3191 case VK_LCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3192 return modifiers[EMACS_LCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3193 case VK_RCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3194 return modifiers[EMACS_RCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3195 case VK_LMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3196 return modifiers[EMACS_LMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3197 case VK_RMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3198 return modifiers[EMACS_RMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3199 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3200 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3201 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3202 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3203 /* Convert between the modifier bits W32 uses and the modifier bits |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3204 Emacs uses. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3205 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3206 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3207 w32_key_to_modifier (int key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3208 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3209 Lisp_Object key_mapping; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3210 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3211 switch (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3212 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3213 case VK_LWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3214 key_mapping = Vw32_lwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3215 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3216 case VK_RWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3217 key_mapping = Vw32_rwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3218 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3219 case VK_APPS: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3220 key_mapping = Vw32_apps_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3221 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3222 case VK_SCROLL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3223 key_mapping = Vw32_scroll_lock_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3224 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3225 default: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3226 key_mapping = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3227 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3228 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3229 /* NB. This code runs in the input thread, asychronously to the lisp |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3230 thread, so we must be careful to ensure access to lisp data is |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3231 thread-safe. The following code is safe because the modifier |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3232 variable values are updated atomically from lisp and symbols are |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3233 not relocated by GC. Also, we don't have to worry about seeing GC |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3234 markbits here. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3235 if (EQ (key_mapping, Qhyper)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3236 return hyper_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3237 if (EQ (key_mapping, Qsuper)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3238 return super_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3239 if (EQ (key_mapping, Qmeta)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3240 return meta_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3241 if (EQ (key_mapping, Qalt)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3242 return alt_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3243 if (EQ (key_mapping, Qctrl)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3244 return ctrl_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3245 if (EQ (key_mapping, Qcontrol)) /* synonym for ctrl */ |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3246 return ctrl_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3247 if (EQ (key_mapping, Qshift)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3248 return shift_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3249 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3250 /* Don't generate any modifier if not explicitly requested. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3251 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3252 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3253 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3254 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3255 w32_get_modifiers () |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3256 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3257 return ((modifier_set (VK_SHIFT) ? shift_modifier : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3258 (modifier_set (VK_CONTROL) ? ctrl_modifier : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3259 (modifier_set (VK_LWIN) ? w32_key_to_modifier (VK_LWIN) : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3260 (modifier_set (VK_RWIN) ? w32_key_to_modifier (VK_RWIN) : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3261 (modifier_set (VK_APPS) ? w32_key_to_modifier (VK_APPS) : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3262 (modifier_set (VK_SCROLL) ? w32_key_to_modifier (VK_SCROLL) : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3263 (modifier_set (VK_MENU) ? |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3264 ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier) : 0)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3265 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3266 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3267 /* 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
|
3268 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
|
3269 and window input. */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3270 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3271 static int |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3272 construct_console_modifiers () |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3273 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3274 int mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3275 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3276 mods = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3277 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3278 mods |= (modifier_set (VK_CAPITAL)) ? CAPSLOCK_ON : 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3279 mods |= (modifier_set (VK_SCROLL)) ? SCROLLLOCK_ON : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3280 mods |= (modifier_set (VK_NUMLOCK)) ? NUMLOCK_ON : 0; |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3281 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
|
3282 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
|
3283 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
|
3284 mods |= (modifier_set (VK_RMENU)) ? RIGHT_ALT_PRESSED : 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3285 mods |= (modifier_set (VK_LWIN)) ? LEFT_WIN_PRESSED : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3286 mods |= (modifier_set (VK_RWIN)) ? RIGHT_WIN_PRESSED : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3287 mods |= (modifier_set (VK_APPS)) ? APPS_PRESSED : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3288 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3289 return mods; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3290 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3291 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3292 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3293 w32_get_key_modifiers (unsigned int wparam, unsigned int lparam) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3294 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3295 int mods; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3296 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3297 /* Convert to emacs modifiers. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3298 mods = w32_kbd_mods_to_emacs (construct_console_modifiers (), wparam); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3299 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3300 return mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3301 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3302 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3303 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3304 map_keypad_keys (unsigned int virt_key, unsigned int extended) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3305 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3306 if (virt_key < VK_CLEAR || virt_key > VK_DELETE) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3307 return virt_key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3308 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3309 if (virt_key == VK_RETURN) |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3310 return (extended ? VK_NUMPAD_ENTER : VK_RETURN); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3311 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3312 if (virt_key >= VK_PRIOR && virt_key <= VK_DOWN) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3313 return (!extended ? (VK_NUMPAD_PRIOR + (virt_key - VK_PRIOR)) : virt_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3314 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3315 if (virt_key == VK_INSERT || virt_key == VK_DELETE) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3316 return (!extended ? (VK_NUMPAD_INSERT + (virt_key - VK_INSERT)) : virt_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3317 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3318 if (virt_key == VK_CLEAR) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3319 return (!extended ? VK_NUMPAD_CLEAR : virt_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3320 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3321 return virt_key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3322 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3323 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3324 /* List of special key combinations which w32 would normally capture, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3325 but emacs should grab instead. Not directly visible to lisp, to |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3326 simplify synchronization. Each item is an integer encoding a virtual |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3327 key code and modifier combination to capture. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3328 Lisp_Object w32_grabbed_keys; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3329 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3330 #define HOTKEY(vk,mods) make_number (((vk) & 255) | ((mods) << 8)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3331 #define HOTKEY_ID(k) (XFASTINT (k) & 0xbfff) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3332 #define HOTKEY_VK_CODE(k) (XFASTINT (k) & 255) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3333 #define HOTKEY_MODIFIERS(k) (XFASTINT (k) >> 8) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3334 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3335 /* Register hot-keys for reserved key combinations when Emacs has |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3336 keyboard focus, since this is the only way Emacs can receive key |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3337 combinations like Alt-Tab which are used by the system. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3338 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3339 static void |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3340 register_hot_keys (hwnd) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3341 HWND hwnd; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3342 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3343 Lisp_Object keylist; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3344 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3345 /* Use GC_CONSP, since we are called asynchronously. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3346 for (keylist = w32_grabbed_keys; GC_CONSP (keylist); keylist = XCDR (keylist)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3347 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3348 Lisp_Object key = XCAR (keylist); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3349 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3350 /* Deleted entries get set to nil. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3351 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3352 continue; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3353 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3354 RegisterHotKey (hwnd, HOTKEY_ID (key), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3355 HOTKEY_MODIFIERS (key), HOTKEY_VK_CODE (key)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3356 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3357 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3358 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3359 static void |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3360 unregister_hot_keys (hwnd) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3361 HWND hwnd; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3362 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3363 Lisp_Object keylist; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3364 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3365 /* Use GC_CONSP, since we are called asynchronously. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3366 for (keylist = w32_grabbed_keys; GC_CONSP (keylist); keylist = XCDR (keylist)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3367 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3368 Lisp_Object key = XCAR (keylist); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3369 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3370 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3371 continue; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3372 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3373 UnregisterHotKey (hwnd, HOTKEY_ID (key)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3374 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3375 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3376 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3377 /* Main message dispatch loop. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3378 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3379 static void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3380 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
|
3381 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3382 MSG msg; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3383 int result; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3384 HWND focus_window; |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
3385 |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
3386 msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3387 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3388 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
|
3389 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3390 if (msg.hwnd == NULL) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3391 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3392 switch (msg.message) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3393 { |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3394 case WM_NULL: |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3395 /* Produced by complete_deferred_msg; just ignore. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3396 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3397 case WM_EMACS_CREATEWINDOW: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3398 w32_createwindow ((struct frame *) msg.wParam); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3399 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
|
3400 abort (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3401 break; |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3402 case WM_EMACS_SETLOCALE: |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3403 SetThreadLocale (msg.wParam); |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3404 /* Reply is not expected. */ |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3405 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3406 case WM_EMACS_SETKEYBOARDLAYOUT: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3407 result = (int) ActivateKeyboardLayout ((HKL) msg.wParam, 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3408 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3409 result, 0)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3410 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3411 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3412 case WM_EMACS_REGISTER_HOT_KEY: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3413 focus_window = GetFocus (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3414 if (focus_window != NULL) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3415 RegisterHotKey (focus_window, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3416 HOTKEY_ID (msg.wParam), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3417 HOTKEY_MODIFIERS (msg.wParam), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3418 HOTKEY_VK_CODE (msg.wParam)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3419 /* Reply is not expected. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3420 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3421 case WM_EMACS_UNREGISTER_HOT_KEY: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3422 focus_window = GetFocus (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3423 if (focus_window != NULL) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3424 UnregisterHotKey (focus_window, HOTKEY_ID (msg.wParam)); |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3425 /* Mark item as erased. NB: this code must be |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3426 thread-safe. The next line is okay because the cons |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3427 cell is never made into garbage and is not relocated by |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3428 GC. */ |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3429 XCAR ((Lisp_Object) msg.lParam) = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3430 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3431 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3432 break; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3433 case WM_EMACS_TOGGLE_LOCK_KEY: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3434 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3435 int vk_code = (int) msg.wParam; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3436 int cur_state = (GetKeyState (vk_code) & 1); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3437 Lisp_Object new_state = (Lisp_Object) msg.lParam; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3438 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3439 /* NB: This code must be thread-safe. It is safe to |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3440 call NILP because symbols are not relocated by GC, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3441 and pointer here is not touched by GC (so the markbit |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3442 can't be set). Numbers are safe because they are |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3443 immediate values. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3444 if (NILP (new_state) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3445 || (NUMBERP (new_state) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3446 && (XUINT (new_state)) & 1 != cur_state)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3447 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3448 one_w32_display_info.faked_key = vk_code; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3449 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3450 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3451 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3452 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3453 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3454 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3455 KEYEVENTF_EXTENDEDKEY | 0, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3456 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3457 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3458 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3459 cur_state = !cur_state; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3460 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3461 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3462 cur_state, 0)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3463 abort (); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3464 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3465 break; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3466 default: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3467 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
|
3468 } |
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 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3471 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3472 DispatchMessage (&msg); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3473 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3474 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3475 /* 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
|
3476 if (msg_buf->completed) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3477 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3478 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3479 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3480 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3481 deferred_msg * deferred_msg_head; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3482 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3483 static deferred_msg * |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3484 find_deferred_msg (HWND hwnd, UINT msg) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3485 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3486 deferred_msg * item; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3487 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3488 /* 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
|
3489 modification of single pointer is always atomic. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3490 /* enter_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3491 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3492 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
|
3493 if (item->w32msg.msg.hwnd == hwnd |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3494 && item->w32msg.msg.message == msg) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3495 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3496 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3497 /* leave_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3498 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3499 return item; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3500 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3501 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3502 static LRESULT |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3503 send_deferred_msg (deferred_msg * msg_buf, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3504 HWND hwnd, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3505 UINT msg, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3506 WPARAM wParam, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3507 LPARAM lParam) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3508 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3509 /* Only input thread can send deferred messages. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3510 if (GetCurrentThreadId () != dwWindowsThreadId) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3511 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3512 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3513 /* 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
|
3514 if (find_deferred_msg (hwnd, msg) != NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3515 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3516 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3517 /* 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
|
3518 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
|
3519 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
|
3520 input thread can call us). */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3521 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3522 /* enter_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3523 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3524 msg_buf->completed = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3525 msg_buf->next = deferred_msg_head; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3526 deferred_msg_head = msg_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3527 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
|
3528 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3529 /* leave_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3530 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3531 /* 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
|
3532 this one is completed. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3533 w32_msg_pump (msg_buf); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3534 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3535 deferred_msg_head = msg_buf->next; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3536 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3537 return msg_buf->result; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3538 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3539 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3540 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3541 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
|
3542 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3543 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
|
3544 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3545 if (msg_buf == NULL) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3546 /* Message may have been cancelled, so don't abort(). */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3547 return; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3548 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3549 msg_buf->result = result; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3550 msg_buf->completed = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3551 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3552 /* 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
|
3553 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3554 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3555 |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3556 void |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3557 cancel_all_deferred_msgs () |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3558 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3559 deferred_msg * item; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3560 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3561 /* Don't actually need synchronization for read access, since |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3562 modification of single pointer is always atomic. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3563 /* enter_crit (); */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3564 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3565 for (item = deferred_msg_head; item != NULL; item = item->next) |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3566 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3567 item->result = 0; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3568 item->completed = 1; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3569 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3570 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3571 /* leave_crit (); */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3572 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3573 /* Ensure input thread is woken so it notices the completion. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3574 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3575 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3576 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3577 DWORD |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3578 w32_msg_worker (dw) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3579 DWORD dw; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3580 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3581 MSG msg; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3582 deferred_msg dummy_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3583 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3584 /* 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
|
3585 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3586 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3587 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3588 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
|
3589 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3590 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3591 memset (&dummy_buf, 0, sizeof (dummy_buf)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3592 dummy_buf.w32msg.msg.hwnd = NULL; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3593 dummy_buf.w32msg.msg.message = WM_NULL; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3594 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3595 /* 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
|
3596 application quits. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3597 w32_msg_pump (&dummy_buf); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3598 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3599 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3600 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3601 |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3602 static void |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3603 post_character_message (hwnd, msg, wParam, lParam, modifiers) |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3604 HWND hwnd; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3605 UINT msg; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3606 WPARAM wParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3607 LPARAM lParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3608 DWORD modifiers; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3609 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3610 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3611 W32Msg wmsg; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3612 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3613 wmsg.dwModifiers = modifiers; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3614 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3615 /* Detect quit_char and set quit-flag directly. Note that we |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3616 still need to post a message to ensure the main thread will be |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3617 woken up if blocked in sys_select(), but we do NOT want to post |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3618 the quit_char message itself (because it will usually be as if |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3619 the user had typed quit_char twice). Instead, we post a dummy |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3620 message that has no particular effect. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3621 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3622 int c = wParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3623 if (isalpha (c) && wmsg.dwModifiers == ctrl_modifier) |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3624 c = make_ctrl_char (c) & 0377; |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
3625 if (c == quit_char |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
3626 || (wmsg.dwModifiers == 0 && |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
3627 XFASTINT (Vw32_quit_key) && wParam == XFASTINT (Vw32_quit_key))) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3628 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3629 Vquit_flag = Qt; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3630 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3631 /* The choice of message is somewhat arbitrary, as long as |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3632 the main thread handler just ignores it. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3633 msg = WM_NULL; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3634 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3635 /* Interrupt any blocking system calls. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3636 signal_quit (); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3637 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3638 /* As a safety precaution, forcibly complete any deferred |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3639 messages. This is a kludge, but I don't see any particularly |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3640 clean way to handle the situation where a deferred message is |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3641 "dropped" in the lisp thread, and will thus never be |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3642 completed, eg. by the user trying to activate the menubar |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3643 when the lisp thread is busy, and then typing C-g when the |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3644 menubar doesn't open promptly (with the result that the |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3645 menubar never responds at all because the deferred |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3646 WM_INITMENU message is never completed). Another problem |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3647 situation is when the lisp thread calls SendMessage (to send |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3648 a window manager command) when a message has been deferred; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3649 the lisp thread gets blocked indefinitely waiting for the |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3650 deferred message to be completed, which itself is waiting for |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3651 the lisp thread to respond. |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3652 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3653 Note that we don't want to block the input thread waiting for |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3654 a reponse from the lisp thread (although that would at least |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3655 solve the deadlock problem above), because we want to be able |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3656 to receive C-g to interrupt the lisp thread. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3657 cancel_all_deferred_msgs (); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3658 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3659 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3660 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3661 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3662 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3663 |
13434 | 3664 /* Main window procedure */ |
3665 | |
3666 LRESULT CALLBACK | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3667 w32_wnd_proc (hwnd, msg, wParam, lParam) |
13434 | 3668 HWND hwnd; |
3669 UINT msg; | |
3670 WPARAM wParam; | |
3671 LPARAM lParam; | |
3672 { | |
3673 struct frame *f; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3674 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
|
3675 W32Msg wmsg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3676 int windows_translate; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3677 int key; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3678 |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3679 /* 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
|
3680 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
|
3681 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
|
3682 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
|
3683 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
|
3684 |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3685 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
|
3686 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
|
3687 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
|
3688 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
|
3689 delete-frame has synchronized with this thread. |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3690 |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3691 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
|
3692 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
|
3693 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
|
3694 |
13434 | 3695 switch (msg) |
3696 { | |
3697 case WM_ERASEBKGND: | |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3698 f = x_window_to_frame (dpyinfo, hwnd); |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3699 if (f) |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3700 { |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3701 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
|
3702 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
|
3703 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3704 return 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3705 case WM_PALETTECHANGED: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3706 /* ignore our own changes */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3707 if ((HWND)wParam != hwnd) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3708 { |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3709 f = x_window_to_frame (dpyinfo, hwnd); |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3710 if (f) |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3711 /* 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
|
3712 frames to be redrawn if needed. */ |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
3713 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
|
3714 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3715 return 0; |
13434 | 3716 case WM_PAINT: |
3717 { | |
3718 PAINTSTRUCT paintStruct; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3719 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3720 enter_crit (); |
13434 | 3721 BeginPaint (hwnd, &paintStruct); |
3722 wmsg.rect = paintStruct.rcPaint; | |
3723 EndPaint (hwnd, &paintStruct); | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3724 leave_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3725 |
13434 | 3726 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
3727 | |
3728 return (0); | |
3729 } | |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3730 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3731 case WM_INPUTLANGCHANGE: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3732 /* Inform lisp thread of keyboard layout changes. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3733 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3734 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3735 /* Clear dead keys in the keyboard state; for simplicity only |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3736 preserve modifier key states. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3737 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3738 int i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3739 BYTE keystate[256]; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3740 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3741 GetKeyboardState (keystate); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3742 for (i = 0; i < 256; i++) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3743 if (1 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3744 && i != VK_SHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3745 && i != VK_LSHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3746 && i != VK_RSHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3747 && i != VK_CAPITAL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3748 && i != VK_NUMLOCK |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3749 && i != VK_SCROLL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3750 && i != VK_CONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3751 && i != VK_LCONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3752 && i != VK_RCONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3753 && i != VK_MENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3754 && i != VK_LMENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3755 && i != VK_RMENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3756 && i != VK_LWIN |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3757 && i != VK_RWIN) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3758 keystate[i] = 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3759 SetKeyboardState (keystate); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3760 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3761 goto dflt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3762 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3763 case WM_HOTKEY: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3764 /* Synchronize hot keys with normal input. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3765 PostMessage (hwnd, WM_KEYDOWN, HIWORD (lParam), 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3766 return (0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3767 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3768 case WM_KEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3769 case WM_SYSKEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3770 record_keyup (wParam, lParam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3771 goto dflt; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3772 |
13434 | 3773 case WM_KEYDOWN: |
3774 case WM_SYSKEYDOWN: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3775 /* Ignore keystrokes we fake ourself; see below. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3776 if (dpyinfo->faked_key == wParam) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3777 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3778 dpyinfo->faked_key = 0; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3779 /* Make sure TranslateMessage sees them though (as long as |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3780 they don't produce WM_CHAR messages). This ensures that |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3781 indicator lights are toggled promptly on Windows 9x, for |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3782 example. */ |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3783 if (lispy_function_keys[wParam] != 0) |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3784 { |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3785 windows_translate = 1; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3786 goto translate; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3787 } |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3788 return 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3789 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3790 |
15377
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3791 /* Synchronize modifiers with current keystroke. */ |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3792 sync_modifiers (); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3793 record_keydown (wParam, lParam); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3794 wParam = map_keypad_keys (wParam, (lParam & 0x1000000L) != 0); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3795 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3796 windows_translate = 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3797 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3798 switch (wParam) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3799 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3800 case VK_LWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3801 if (NILP (Vw32_pass_lwindow_to_system)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3802 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3803 /* Prevent system from acting on keyup (which opens the |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3804 Start menu if no other key was pressed) by simulating a |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3805 press of Space which we will ignore. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3806 if (GetAsyncKeyState (wParam) & 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3807 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3808 if (NUMBERP (Vw32_phantom_key_code)) |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3809 key = XUINT (Vw32_phantom_key_code) & 255; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3810 else |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3811 key = VK_SPACE; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3812 dpyinfo->faked_key = key; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3813 keybd_event (key, (BYTE) MapVirtualKey (key, 0), 0, 0); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3814 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3815 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3816 if (!NILP (Vw32_lwindow_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3817 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3818 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3819 case VK_RWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3820 if (NILP (Vw32_pass_rwindow_to_system)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3821 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3822 if (GetAsyncKeyState (wParam) & 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3823 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3824 if (NUMBERP (Vw32_phantom_key_code)) |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3825 key = XUINT (Vw32_phantom_key_code) & 255; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3826 else |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3827 key = VK_SPACE; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3828 dpyinfo->faked_key = key; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3829 keybd_event (key, (BYTE) MapVirtualKey (key, 0), 0, 0); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3830 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3831 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3832 if (!NILP (Vw32_rwindow_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3833 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3834 break; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
3835 case VK_APPS: |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3836 if (!NILP (Vw32_apps_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3837 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3838 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3839 case VK_MENU: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3840 if (NILP (Vw32_pass_alt_to_system)) |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3841 /* Prevent DefWindowProc from activating the menu bar if an |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3842 Alt key is pressed and released by itself. */ |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3843 return 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3844 windows_translate = 1; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3845 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3846 case VK_CAPITAL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3847 /* Decide whether to treat as modifier or function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3848 if (NILP (Vw32_enable_caps_lock)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3849 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3850 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3851 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3852 case VK_NUMLOCK: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3853 /* Decide whether to treat as modifier or function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3854 if (NILP (Vw32_enable_num_lock)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3855 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3856 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3857 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3858 case VK_SCROLL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3859 /* Decide whether to treat as modifier or function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3860 if (NILP (Vw32_scroll_lock_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3861 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3862 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3863 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3864 disable_lock_key: |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3865 /* Ensure the appropriate lock key state (and indicator light) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3866 remains in the same state. We do this by faking another |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3867 press of the relevant key. Apparently, this really is the |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3868 only way to toggle the state of the indicator lights. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3869 dpyinfo->faked_key = wParam; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3870 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3871 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3872 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3873 KEYEVENTF_EXTENDEDKEY | 0, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3874 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3875 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3876 /* Ensure indicator lights are updated promptly on Windows 9x |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3877 (TranslateMessage apparently does this), after forwarding |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3878 input event. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3879 post_character_message (hwnd, msg, wParam, lParam, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3880 w32_get_key_modifiers (wParam, lParam)); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3881 windows_translate = 1; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3882 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3883 case VK_CONTROL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3884 case VK_SHIFT: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3885 case VK_PROCESSKEY: /* Generated by IME. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3886 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3887 break; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3888 case VK_CANCEL: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3889 /* Windows maps Ctrl-Pause (aka Ctrl-Break) into VK_CANCEL, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3890 which is confusing for purposes of key binding; convert |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3891 VK_CANCEL events into VK_PAUSE events. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3892 wParam = VK_PAUSE; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3893 break; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3894 case VK_PAUSE: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3895 /* Windows maps Ctrl-NumLock into VK_PAUSE, which is confusing |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3896 for purposes of key binding; convert these back into |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3897 VK_NUMLOCK events, at least when we want to see NumLock key |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3898 presses. (Note that there is never any possibility that |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3899 VK_PAUSE with Ctrl really is C-Pause as per above.) */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3900 if (NILP (Vw32_enable_num_lock) && modifier_set (VK_CONTROL)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3901 wParam = VK_NUMLOCK; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3902 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3903 default: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3904 /* If not defined as a function key, change it to a WM_CHAR message. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3905 if (lispy_function_keys[wParam] == 0) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3906 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3907 DWORD modifiers = construct_console_modifiers (); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3908 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3909 if (!NILP (Vw32_recognize_altgr) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3910 && modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3911 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3912 /* Always let TranslateMessage handle AltGr key chords; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3913 for some reason, ToAscii doesn't always process AltGr |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3914 chords correctly. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3915 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3916 } |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3917 else if ((modifiers & (~SHIFT_PRESSED & ~CAPSLOCK_ON)) != 0) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3918 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3919 /* Handle key chords including any modifiers other |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3920 than shift directly, in order to preserve as much |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3921 modifier information as possible. */ |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3922 if ('A' <= wParam && wParam <= 'Z') |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3923 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3924 /* Don't translate modified alphabetic keystrokes, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3925 so the user doesn't need to constantly switch |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3926 layout to type control or meta keystrokes when |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3927 the normal layout translates alphabetic |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3928 characters to non-ascii characters. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3929 if (!modifier_set (VK_SHIFT)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3930 wParam += ('a' - 'A'); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3931 msg = WM_CHAR; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3932 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3933 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3934 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3935 /* Try to handle other keystrokes by determining the |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3936 base character (ie. translating the base key plus |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3937 shift modifier). */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3938 int add; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3939 int isdead = 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3940 KEY_EVENT_RECORD key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3941 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3942 key.bKeyDown = TRUE; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3943 key.wRepeatCount = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3944 key.wVirtualKeyCode = wParam; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3945 key.wVirtualScanCode = (lParam & 0xFF0000) >> 16; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3946 key.uChar.AsciiChar = 0; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3947 key.dwControlKeyState = modifiers; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3948 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3949 add = w32_kbd_patch_key (&key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3950 /* 0 means an unrecognised keycode, negative means |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3951 dead key. Ignore both. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3952 while (--add >= 0) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3953 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3954 /* Forward asciified character sequence. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3955 post_character_message |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3956 (hwnd, WM_CHAR, key.uChar.AsciiChar, lParam, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3957 w32_get_key_modifiers (wParam, lParam)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3958 w32_kbd_patch_key (&key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3959 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3960 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3961 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3962 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3963 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3964 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3965 /* Let TranslateMessage handle everything else. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3966 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3967 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3968 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3969 } |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3970 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3971 translate: |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3972 if (windows_translate) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3973 { |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3974 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
|
3975 |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3976 windows_msg.time = GetMessageTime (); |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3977 TranslateMessage (&windows_msg); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3978 goto dflt; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3979 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
3980 |
13434 | 3981 /* Fall through */ |
3982 | |
3983 case WM_SYSCHAR: | |
3984 case WM_CHAR: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3985 post_character_message (hwnd, msg, wParam, lParam, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3986 w32_get_key_modifiers (wParam, lParam)); |
13434 | 3987 break; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3988 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3989 /* 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
|
3990 are used together, but only if user has two button mouse. */ |
13434 | 3991 case WM_LBUTTONDOWN: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3992 case WM_RBUTTONDOWN: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3993 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
|
3994 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3995 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3996 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3997 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
|
3998 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
|
3999 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4000 if (button_state & this) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4001 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4002 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4003 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4004 SetCapture (hwnd); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4005 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4006 button_state |= this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4007 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4008 if (button_state & other) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4009 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4010 if (mouse_button_timer) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4011 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4012 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4013 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4014 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4015 /* Generate middle mouse event instead. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4016 msg = WM_MBUTTONDOWN; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4017 button_state |= MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4018 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4019 else if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4020 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4021 /* 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
|
4022 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
|
4023 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
|
4024 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
|
4025 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4026 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4027 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4028 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4029 /* Flush out saved message. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4030 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
|
4031 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4032 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
|
4033 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
|
4034 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4035 /* Clear message buffer. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4036 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
|
4037 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4038 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4039 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4040 /* Hold onto message for now. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4041 mouse_button_timer = |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4042 SetTimer (hwnd, MOUSE_BUTTON_ID, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4043 XINT (Vw32_mouse_button_tolerance), NULL); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4044 saved_mouse_button_msg.msg.hwnd = hwnd; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4045 saved_mouse_button_msg.msg.message = msg; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4046 saved_mouse_button_msg.msg.wParam = wParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4047 saved_mouse_button_msg.msg.lParam = lParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4048 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
|
4049 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
|
4050 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4051 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4052 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4053 |
13434 | 4054 case WM_LBUTTONUP: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4055 case WM_RBUTTONUP: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4056 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
|
4057 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4058 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4059 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4060 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
|
4061 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
|
4062 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4063 if ((button_state & this) == 0) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4064 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4065 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4066 button_state &= ~this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4067 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4068 if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4069 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4070 /* 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
|
4071 if ((button_state & other) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4072 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4073 msg = WM_MBUTTONUP; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4074 button_state &= ~MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4075 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4076 if (button_state) abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4077 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4078 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4079 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4080 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4081 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4082 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4083 /* Flush out saved message if necessary. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4084 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
|
4085 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4086 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
|
4087 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4088 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4089 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
|
4090 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
|
4091 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4092 /* 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
|
4093 saved_mouse_button_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4094 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4095 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4096 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4097 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4098 ReleaseCapture (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4099 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4100 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4101 |
13434 | 4102 case WM_MBUTTONDOWN: |
4103 case WM_MBUTTONUP: | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4104 handle_plain_button: |
13434 | 4105 { |
4106 BOOL up; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4107 int button; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4108 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4109 if (parse_button (msg, &button, &up)) |
13434 | 4110 { |
4111 if (up) ReleaseCapture (); | |
4112 else SetCapture (hwnd); | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4113 button = (button == 0) ? LMOUSE : |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4114 ((button == 1) ? MMOUSE : RMOUSE); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4115 if (up) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4116 button_state &= ~button; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4117 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4118 button_state |= button; |
13434 | 4119 } |
4120 } | |
4121 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4122 wmsg.dwModifiers = w32_get_modifiers (); |
13434 | 4123 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
|
4124 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4125 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4126 case WM_VSCROLL: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4127 case WM_MOUSEMOVE: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4128 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
|
4129 || (msg == WM_MOUSEMOVE && button_state == 0)) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4130 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4131 wmsg.dwModifiers = w32_get_modifiers (); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4132 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
|
4133 return 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4134 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4135 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4136 /* 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
|
4137 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
|
4138 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
|
4139 expires, we just replace the first message. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4140 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4141 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
|
4142 mouse_move_timer = |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4143 SetTimer (hwnd, MOUSE_MOVE_ID, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4144 XINT (Vw32_mouse_move_interval), NULL); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4145 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4146 /* Hold onto message for now. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4147 saved_mouse_move_msg.msg.hwnd = hwnd; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4148 saved_mouse_move_msg.msg.message = msg; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4149 saved_mouse_move_msg.msg.wParam = wParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4150 saved_mouse_move_msg.msg.lParam = lParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4151 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
|
4152 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
|
4153 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4154 return 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4155 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4156 case WM_MOUSEWHEEL: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4157 wmsg.dwModifiers = w32_get_modifiers (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4158 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
|
4159 return 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4160 |
21884 | 4161 case WM_DROPFILES: |
4162 wmsg.dwModifiers = w32_get_modifiers (); | |
4163 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | |
4164 return 0; | |
4165 | |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4166 case WM_TIMER: |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4167 /* Flush out saved messages if necessary. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4168 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
|
4169 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4170 if (saved_mouse_button_msg.msg.hwnd) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4171 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4172 post_msg (&saved_mouse_button_msg); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4173 saved_mouse_button_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4174 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4175 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4176 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4177 } |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4178 else if (wParam == mouse_move_timer) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4179 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4180 if (saved_mouse_move_msg.msg.hwnd) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4181 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4182 post_msg (&saved_mouse_move_msg); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4183 saved_mouse_move_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4184 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4185 KillTimer (hwnd, mouse_move_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4186 mouse_move_timer = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4187 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4188 return 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4189 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4190 case WM_NCACTIVATE: |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4191 /* 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
|
4192 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
|
4193 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
|
4194 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
|
4195 keyboard modifiers' state. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4196 reset_modifiers (); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4197 goto dflt; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4198 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4199 case WM_INITMENU: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4200 /* 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
|
4201 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
|
4202 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
|
4203 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
|
4204 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
|
4205 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4206 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
|
4207 loop that can process all other messages. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4208 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4209 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
|
4210 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
|
4211 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
|
4212 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
|
4213 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
|
4214 being active). */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4215 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4216 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4217 if (f |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4218 && (f->output_data.w32->menubar_active |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4219 /* 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
|
4220 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
|
4221 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
|
4222 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
|
4223 had requested it to be turned off! */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4224 || f->output_data.w32->menubar_widget == NULL)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4225 return 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4226 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4227 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4228 deferred_msg msg_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4229 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4230 /* 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
|
4231 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
|
4232 if (find_deferred_msg (hwnd, msg) != NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4233 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4234 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4235 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
|
4236 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4237 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4238 case WM_EXITMENULOOP: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4239 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4240 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4241 /* Indicate that menubar can be modified again. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4242 if (f) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4243 f->output_data.w32->menubar_active = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4244 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4245 |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4246 case WM_MEASUREITEM: |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4247 f = x_window_to_frame (dpyinfo, hwnd); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4248 if (f) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4249 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4250 MEASUREITEMSTRUCT * pMis = (MEASUREITEMSTRUCT *) lParam; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4251 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4252 if (pMis->CtlType == ODT_MENU) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4253 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4254 /* Work out dimensions for popup menu titles. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4255 char * title = (char *) pMis->itemData; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4256 HDC hdc = GetDC (hwnd); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4257 HFONT menu_font = GetCurrentObject (hdc, OBJ_FONT); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4258 LOGFONT menu_logfont; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4259 HFONT old_font; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4260 SIZE size; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4261 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4262 GetObject (menu_font, sizeof (menu_logfont), &menu_logfont); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4263 menu_logfont.lfWeight = FW_BOLD; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4264 menu_font = CreateFontIndirect (&menu_logfont); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4265 old_font = SelectObject (hdc, menu_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4266 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4267 GetTextExtentPoint32 (hdc, title, strlen (title), &size); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4268 pMis->itemWidth = size.cx; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4269 pMis->itemHeight = GetSystemMetrics (SM_CYMENUSIZE); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4270 if (pMis->itemHeight < size.cy) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4271 pMis->itemHeight = size.cy; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4272 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4273 SelectObject (hdc, old_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4274 DeleteObject (menu_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4275 ReleaseDC (hwnd, hdc); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4276 return TRUE; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4277 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4278 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4279 return 0; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4280 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4281 case WM_DRAWITEM: |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4282 f = x_window_to_frame (dpyinfo, hwnd); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4283 if (f) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4284 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4285 DRAWITEMSTRUCT * pDis = (DRAWITEMSTRUCT *) lParam; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4286 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4287 if (pDis->CtlType == ODT_MENU) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4288 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4289 /* Draw popup menu title. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4290 char * title = (char *) pDis->itemData; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4291 HDC hdc = pDis->hDC; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4292 HFONT menu_font = GetCurrentObject (hdc, OBJ_FONT); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4293 LOGFONT menu_logfont; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4294 HFONT old_font; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4295 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4296 GetObject (menu_font, sizeof (menu_logfont), &menu_logfont); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4297 menu_logfont.lfWeight = FW_BOLD; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4298 menu_font = CreateFontIndirect (&menu_logfont); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4299 old_font = SelectObject (hdc, menu_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4300 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4301 /* Always draw title as if not selected. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4302 ExtTextOut (hdc, |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4303 pDis->rcItem.left + GetSystemMetrics (SM_CXMENUCHECK), |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4304 pDis->rcItem.top, |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4305 ETO_OPAQUE, &pDis->rcItem, |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4306 title, strlen (title), NULL); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4307 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4308 SelectObject (hdc, old_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4309 DeleteObject (menu_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4310 return TRUE; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4311 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4312 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4313 return 0; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4314 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4315 #if 0 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4316 /* 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
|
4317 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
|
4318 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
|
4319 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
|
4320 case WM_MOUSEACTIVATE: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4321 /* 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
|
4322 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
|
4323 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
|
4324 if (LOWORD (lParam) == HTCLIENT ) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4325 return MA_ACTIVATEANDEAT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4326 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4327 #endif |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4328 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4329 case WM_ACTIVATEAPP: |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4330 case WM_ACTIVATE: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4331 case WM_WINDOWPOSCHANGED: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4332 case WM_SHOWWINDOW: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4333 /* 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
|
4334 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
|
4335 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
|
4336 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4337 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4338 case WM_SETFOCUS: |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4339 dpyinfo->faked_key = 0; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4340 reset_modifiers (); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4341 register_hot_keys (hwnd); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4342 goto command; |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
4343 case WM_KILLFOCUS: |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4344 unregister_hot_keys (hwnd); |
13434 | 4345 case WM_MOVE: |
4346 case WM_SIZE: | |
4347 case WM_COMMAND: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4348 command: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4349 wmsg.dwModifiers = w32_get_modifiers (); |
13434 | 4350 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
4351 goto dflt; | |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
4352 |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
4353 case WM_CLOSE: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4354 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
|
4355 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
|
4356 return 0; |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
4357 |
13434 | 4358 case WM_WINDOWPOSCHANGING: |
4359 { | |
4360 WINDOWPLACEMENT wp; | |
4361 LPWINDOWPOS lppos = (WINDOWPOS *) lParam; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4362 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4363 wp.length = sizeof (WINDOWPLACEMENT); |
13434 | 4364 GetWindowPlacement (hwnd, &wp); |
4365 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4366 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0) |
13434 | 4367 { |
4368 RECT rect; | |
4369 int wdiff; | |
4370 int hdiff; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4371 DWORD font_width; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4372 DWORD line_height; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4373 DWORD internal_border; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4374 DWORD scrollbar_extra; |
13434 | 4375 RECT wr; |
4376 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4377 wp.length = sizeof(wp); |
13434 | 4378 GetWindowRect (hwnd, &wr); |
4379 | |
14353 | 4380 enter_crit (); |
13434 | 4381 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4382 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4383 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4384 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4385 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX); |
13434 | 4386 |
14353 | 4387 leave_crit (); |
13434 | 4388 |
4389 memset (&rect, 0, sizeof (rect)); | |
4390 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE), | |
4391 GetMenu (hwnd) != NULL); | |
4392 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4393 /* 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
|
4394 multiples of the character cell dimensions. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4395 wdiff = (lppos->cx - (rect.right - rect.left) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4396 - 2 * internal_border - scrollbar_extra) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4397 % font_width; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4398 hdiff = (lppos->cy - (rect.bottom - rect.top) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4399 - 2 * internal_border) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4400 % line_height; |
13434 | 4401 |
4402 if (wdiff || hdiff) | |
4403 { | |
4404 /* For right/bottom sizing we can just fix the sizes. | |
4405 However for top/left sizing we will need to fix the X | |
4406 and Y positions as well. */ | |
4407 | |
4408 lppos->cx -= wdiff; | |
4409 lppos->cy -= hdiff; | |
4410 | |
4411 if (wp.showCmd != SW_SHOWMAXIMIZED | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4412 && (lppos->flags & SWP_NOMOVE) == 0) |
13434 | 4413 { |
4414 if (lppos->x != wr.left || lppos->y != wr.top) | |
4415 { | |
4416 lppos->x += wdiff; | |
4417 lppos->y += hdiff; | |
4418 } | |
4419 else | |
4420 { | |
4421 lppos->flags |= SWP_NOMOVE; | |
4422 } | |
4423 } | |
4424 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4425 return 0; |
13434 | 4426 } |
4427 } | |
4428 } | |
4429 | |
4430 goto dflt; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4431 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4432 case WM_EMACS_CREATESCROLLBAR: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4433 return (LRESULT) w32_createscrollbar ((struct frame *) wParam, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4434 (struct scroll_bar *) lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4435 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4436 case WM_EMACS_SHOWWINDOW: |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4437 return ShowWindow ((HWND) wParam, (WPARAM) lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4438 |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
4439 case WM_EMACS_SETFOREGROUND: |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
4440 return SetForegroundWindow ((HWND) wParam); |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
4441 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4442 case WM_EMACS_SETWINDOWPOS: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4443 { |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4444 WINDOWPOS * pos = (WINDOWPOS *) wParam; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4445 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
|
4446 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
|
4447 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4448 |
13434 | 4449 case WM_EMACS_DESTROYWINDOW: |
21884 | 4450 DragAcceptFiles ((HWND) wParam, FALSE); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4451 return DestroyWindow ((HWND) wParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4452 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4453 case WM_EMACS_TRACKPOPUPMENU: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4454 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4455 UINT flags; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4456 POINT *pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4457 int retval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4458 pos = (POINT *)lParam; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4459 flags = TPM_CENTERALIGN; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4460 if (button_state & LMOUSE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4461 flags |= TPM_LEFTBUTTON; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4462 else if (button_state & RMOUSE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4463 flags |= TPM_RIGHTBUTTON; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4464 |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4465 /* Remember we did a SetCapture on the initial mouse down event, |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4466 so for safety, we make sure the capture is cancelled now. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4467 ReleaseCapture (); |
23160
95a213639589
(w32_wnd_proc): Always zero button_state when releasing
Geoff Voelker <voelker@cs.washington.edu>
parents:
22625
diff
changeset
|
4468 button_state = 0; |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4469 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4470 /* 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
|
4471 TrackPopupMenu below, and should be ignored. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4472 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4473 if (f) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4474 f->output_data.w32->menubar_active = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4475 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4476 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
|
4477 0, hwnd, NULL)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4478 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4479 MSG amsg; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4480 /* Eat any mouse messages during popupmenu */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4481 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
|
4482 PM_REMOVE)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4483 /* Get the menu selection, if any */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4484 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
|
4485 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4486 retval = LOWORD (amsg.wParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4487 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4488 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4489 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4490 retval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4491 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4492 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4493 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4494 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4495 retval = -1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4496 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4497 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4498 return retval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4499 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4500 |
13434 | 4501 default: |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
4502 /* Check for messages registered at runtime. */ |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
4503 if (msg == msh_mousewheel) |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
4504 { |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
4505 wmsg.dwModifiers = w32_get_modifiers (); |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
4506 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
4507 return 0; |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
4508 } |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
4509 |
13434 | 4510 dflt: |
4511 return DefWindowProc (hwnd, msg, wParam, lParam); | |
4512 } | |
4513 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4514 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4515 /* 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
|
4516 return 0; |
13434 | 4517 } |
4518 | |
4519 void | |
4520 my_create_window (f) | |
4521 struct frame * f; | |
4522 { | |
4523 MSG msg; | |
4524 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4525 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
|
4526 abort (); |
13434 | 4527 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
4528 } | |
4529 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4530 /* Create and set up the w32 window for frame F. */ |
13434 | 4531 |
4532 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4533 w32_window (f, window_prompting, minibuffer_only) |
13434 | 4534 struct frame *f; |
4535 long window_prompting; | |
4536 int minibuffer_only; | |
4537 { | |
4538 BLOCK_INPUT; | |
4539 | |
4540 /* Use the resource name as the top-level window name | |
4541 for looking up resources. Make a non-Lisp copy | |
4542 for the window manager, so GC relocation won't bother it. | |
4543 | |
4544 Elsewhere we specify the window name for the window manager. */ | |
4545 | |
4546 { | |
4547 char *str = (char *) XSTRING (Vx_resource_name)->data; | |
4548 f->namebuf = (char *) xmalloc (strlen (str) + 1); | |
4549 strcpy (f->namebuf, str); | |
4550 } | |
4551 | |
4552 my_create_window (f); | |
4553 | |
4554 validate_x_resource_name (); | |
4555 | |
4556 /* x_set_name normally ignores requests to set the name if the | |
4557 requested name is the same as the current name. This is the one | |
4558 place where that assumption isn't correct; f->name is set, but | |
4559 the server hasn't been told. */ | |
4560 { | |
4561 Lisp_Object name; | |
4562 int explicit = f->explicit_name; | |
4563 | |
4564 f->explicit_name = 0; | |
4565 name = f->name; | |
4566 f->name = Qnil; | |
4567 x_set_name (f, name, explicit); | |
4568 } | |
4569 | |
4570 UNBLOCK_INPUT; | |
4571 | |
4572 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) | |
4573 initialize_frame_menubar (f); | |
4574 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4575 if (FRAME_W32_WINDOW (f) == 0) |
13434 | 4576 error ("Unable to create window"); |
4577 } | |
4578 | |
4579 /* Handle the icon stuff for this window. Perhaps later we might | |
4580 want an x_set_icon_position which can be called interactively as | |
4581 well. */ | |
4582 | |
4583 static void | |
4584 x_icon (f, parms) | |
4585 struct frame *f; | |
4586 Lisp_Object parms; | |
4587 { | |
4588 Lisp_Object icon_x, icon_y; | |
4589 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4590 /* Set the position of the icon. Note that Windows 95 groups all |
13434 | 4591 icons in the tray. */ |
4592 icon_x = x_get_arg (parms, Qicon_left, 0, 0, number); | |
4593 icon_y = x_get_arg (parms, Qicon_top, 0, 0, number); | |
4594 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) | |
4595 { | |
4596 CHECK_NUMBER (icon_x, 0); | |
4597 CHECK_NUMBER (icon_y, 0); | |
4598 } | |
4599 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | |
4600 error ("Both left and top icon corners of icon must be specified"); | |
4601 | |
4602 BLOCK_INPUT; | |
4603 | |
4604 if (! EQ (icon_x, Qunbound)) | |
4605 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); | |
4606 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4607 #if 0 /* TODO */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4608 /* Start up iconic or window? */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4609 x_wm_set_window_state |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4610 (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
|
4611 ? IconicState |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4612 : NormalState)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4613 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4614 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
|
4615 ? f->icon_name |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4616 : f->name))->data); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4617 #endif |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4618 |
13434 | 4619 UNBLOCK_INPUT; |
4620 } | |
4621 | |
4622 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | |
4623 1, 1, 0, | |
4624 "Make a new window, which is called a \"frame\" in Emacs terms.\n\ | |
4625 Returns an Emacs frame object.\n\ | |
4626 ALIST is an alist of frame parameters.\n\ | |
4627 If the parameters specify that the frame should not have a minibuffer,\n\ | |
4628 and do not specify a specific minibuffer window to use,\n\ | |
4629 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\ | |
4630 be shared by the new frame.\n\ | |
4631 \n\ | |
4632 This function is an internal primitive--use `make-frame' instead.") | |
4633 (parms) | |
4634 Lisp_Object parms; | |
4635 { | |
4636 struct frame *f; | |
4637 Lisp_Object frame, tem; | |
4638 Lisp_Object name; | |
4639 int minibuffer_only = 0; | |
4640 long window_prompting = 0; | |
4641 int width, height; | |
4642 int count = specpdl_ptr - specpdl; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4643 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
13434 | 4644 Lisp_Object display; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4645 struct w32_display_info *dpyinfo; |
13434 | 4646 Lisp_Object parent; |
4647 struct kboard *kb; | |
4648 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4649 check_w32 (); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4650 |
13434 | 4651 /* Use this general default value to start with |
4652 until we know if this frame has a specified name. */ | |
4653 Vx_resource_name = Vinvocation_name; | |
4654 | |
4655 display = x_get_arg (parms, Qdisplay, 0, 0, string); | |
4656 if (EQ (display, Qunbound)) | |
4657 display = Qnil; | |
4658 dpyinfo = check_x_display_info (display); | |
4659 #ifdef MULTI_KBOARD | |
4660 kb = dpyinfo->kboard; | |
4661 #else | |
4662 kb = &the_only_kboard; | |
4663 #endif | |
4664 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4665 name = x_get_arg (parms, Qname, "name", "Name", string); |
13434 | 4666 if (!STRINGP (name) |
4667 && ! EQ (name, Qunbound) | |
4668 && ! NILP (name)) | |
4669 error ("Invalid frame name--not a string or nil"); | |
4670 | |
4671 if (STRINGP (name)) | |
4672 Vx_resource_name = name; | |
4673 | |
4674 /* See if parent window is specified. */ | |
4675 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number); | |
4676 if (EQ (parent, Qunbound)) | |
4677 parent = Qnil; | |
4678 if (! NILP (parent)) | |
4679 CHECK_NUMBER (parent, 0); | |
4680 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4681 /* 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
|
4682 /* 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
|
4683 it to make_frame_without_minibuffer. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4684 frame = Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4685 GCPRO4 (parms, parent, name, frame); |
13434 | 4686 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol); |
4687 if (EQ (tem, Qnone) || NILP (tem)) | |
4688 f = make_frame_without_minibuffer (Qnil, kb, display); | |
4689 else if (EQ (tem, Qonly)) | |
4690 { | |
4691 f = make_minibuffer_frame (); | |
4692 minibuffer_only = 1; | |
4693 } | |
4694 else if (WINDOWP (tem)) | |
4695 f = make_frame_without_minibuffer (tem, kb, display); | |
4696 else | |
4697 f = make_frame (1); | |
4698 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4699 XSETFRAME (frame, f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4700 |
13434 | 4701 /* Note that Windows does support scroll bars. */ |
4702 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
|
4703 /* 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
|
4704 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL); |
13434 | 4705 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4706 f->output_method = output_w32; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4707 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
|
4708 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
|
4709 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4710 FRAME_FONTSET (f) = -1; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4711 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4712 f->icon_name |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4713 = 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
|
4714 if (! STRINGP (f->icon_name)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4715 f->icon_name = Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4716 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4717 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ |
13434 | 4718 #ifdef MULTI_KBOARD |
4719 FRAME_KBOARD (f) = kb; | |
4720 #endif | |
4721 | |
4722 /* Specify the parent under which to make this window. */ | |
4723 | |
4724 if (!NILP (parent)) | |
4725 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4726 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
|
4727 f->output_data.w32->explicit_parent = 1; |
13434 | 4728 } |
4729 else | |
4730 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4731 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
|
4732 f->output_data.w32->explicit_parent = 0; |
13434 | 4733 } |
4734 | |
4735 /* Note that the frame has no physical cursor right now. */ | |
4736 f->phys_cursor_x = -1; | |
4737 | |
4738 /* Set the name; the functions to which we pass f expect the name to | |
4739 be set. */ | |
4740 if (EQ (name, Qunbound) || NILP (name)) | |
4741 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4742 f->name = build_string (dpyinfo->w32_id_name); |
13434 | 4743 f->explicit_name = 0; |
4744 } | |
4745 else | |
4746 { | |
4747 f->name = name; | |
4748 f->explicit_name = 1; | |
4749 /* use the frame's title when getting resources for this frame. */ | |
4750 specbind (Qx_resource_name, name); | |
4751 } | |
4752 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4753 /* Create fontsets from `global_fontset_alist' before handling fonts. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4754 for (tem = Vglobal_fontset_alist; CONSP (tem); tem = XCONS (tem)->cdr) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4755 fs_register_fontset (f, XCONS (tem)->car); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4756 |
13434 | 4757 /* Extract the window parameters from the supplied values |
4758 that are needed to determine window geometry. */ | |
4759 { | |
4760 Lisp_Object font; | |
4761 | |
4762 font = x_get_arg (parms, Qfont, "font", "Font", string); | |
4763 BLOCK_INPUT; | |
4764 /* First, try whatever font the caller has specified. */ | |
4765 if (STRINGP (font)) | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4766 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4767 tem = Fquery_fontset (font, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4768 if (STRINGP (tem)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4769 font = x_new_fontset (f, XSTRING (tem)->data); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4770 else |
13434 | 4771 font = x_new_font (f, XSTRING (font)->data); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4772 } |
13434 | 4773 /* Try out a font which we hope has bold and italic variations. */ |
4774 if (!STRINGP (font)) | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4775 font = x_new_font (f, "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); |
13434 | 4776 if (! STRINGP (font)) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4777 font = x_new_font (f, "-*-Courier-normal-r-*-*-*-97-*-*-c-*-iso8859-1"); |
13434 | 4778 /* If those didn't work, look for something which will at least work. */ |
4779 if (! STRINGP (font)) | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4780 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-*-*-90-*-c-*-iso8859-1"); |
13434 | 4781 UNBLOCK_INPUT; |
4782 if (! STRINGP (font)) | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4783 font = build_string ("Fixedsys"); |
13434 | 4784 |
4785 x_default_parameter (f, parms, Qfont, font, | |
4786 "font", "Font", string); | |
4787 } | |
4788 | |
4789 x_default_parameter (f, parms, Qborder_width, make_number (2), | |
4790 "borderwidth", "BorderWidth", number); | |
4791 /* This defaults to 2 in order to match xterm. We recognize either | |
4792 internalBorderWidth or internalBorder (which is what xterm calls | |
4793 it). */ | |
4794 if (NILP (Fassq (Qinternal_border_width, parms))) | |
4795 { | |
4796 Lisp_Object value; | |
4797 | |
4798 value = x_get_arg (parms, Qinternal_border_width, | |
4799 "internalBorder", "BorderWidth", number); | |
4800 if (! EQ (value, Qunbound)) | |
4801 parms = Fcons (Fcons (Qinternal_border_width, value), | |
4802 parms); | |
4803 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4804 /* Default internalBorderWidth to 0 on Windows to match other programs. */ |
13434 | 4805 x_default_parameter (f, parms, Qinternal_border_width, make_number (0), |
4806 "internalBorderWidth", "BorderWidth", number); | |
4807 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt, | |
4808 "verticalScrollBars", "ScrollBars", boolean); | |
4809 | |
4810 /* Also do the stuff which must be set before the window exists. */ | |
4811 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), | |
4812 "foreground", "Foreground", string); | |
4813 x_default_parameter (f, parms, Qbackground_color, build_string ("white"), | |
4814 "background", "Background", string); | |
4815 x_default_parameter (f, parms, Qmouse_color, build_string ("black"), | |
4816 "pointerColor", "Foreground", string); | |
4817 x_default_parameter (f, parms, Qcursor_color, build_string ("black"), | |
4818 "cursorColor", "Foreground", string); | |
4819 x_default_parameter (f, parms, Qborder_color, build_string ("black"), | |
4820 "borderColor", "BorderColor", string); | |
4821 | |
4822 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), | |
4823 "menuBar", "MenuBar", number); | |
4824 x_default_parameter (f, parms, Qscroll_bar_width, Qnil, | |
4825 "scrollBarWidth", "ScrollBarWidth", number); | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4826 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
|
4827 "bufferPredicate", "BufferPredicate", symbol); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4828 x_default_parameter (f, parms, Qtitle, Qnil, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4829 "title", "Title", string); |
13434 | 4830 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4831 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
|
4832 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
13434 | 4833 window_prompting = x_figure_window_size (f, parms); |
4834 | |
4835 if (window_prompting & XNegative) | |
4836 { | |
4837 if (window_prompting & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4838 f->output_data.w32->win_gravity = SouthEastGravity; |
13434 | 4839 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4840 f->output_data.w32->win_gravity = NorthEastGravity; |
13434 | 4841 } |
4842 else | |
4843 { | |
4844 if (window_prompting & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4845 f->output_data.w32->win_gravity = SouthWestGravity; |
13434 | 4846 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4847 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 4848 } |
4849 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4850 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
|
4851 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4852 w32_window (f, window_prompting, minibuffer_only); |
13434 | 4853 x_icon (f, parms); |
4854 init_frame_faces (f); | |
4855 | |
4856 /* We need to do this after creating the window, so that the | |
4857 icon-creation functions can say whose icon they're describing. */ | |
4858 x_default_parameter (f, parms, Qicon_type, Qnil, | |
4859 "bitmapIcon", "BitmapIcon", symbol); | |
4860 | |
4861 x_default_parameter (f, parms, Qauto_raise, Qnil, | |
4862 "autoRaise", "AutoRaiseLower", boolean); | |
4863 x_default_parameter (f, parms, Qauto_lower, Qnil, | |
4864 "autoLower", "AutoRaiseLower", boolean); | |
4865 x_default_parameter (f, parms, Qcursor_type, Qbox, | |
4866 "cursorType", "CursorType", symbol); | |
4867 | |
4868 /* Dimensions, especially f->height, must be done via change_frame_size. | |
4869 Change will not be effected unless different from the current | |
4870 f->height. */ | |
4871 width = f->width; | |
4872 height = f->height; | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
4873 f->height = 0; |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
4874 SET_FRAME_WIDTH (f, 0); |
13434 | 4875 change_frame_size (f, height, width, 1, 0); |
4876 | |
4877 /* Tell the server what size and position, etc, we want, | |
4878 and how badly we want them. */ | |
4879 BLOCK_INPUT; | |
4880 x_wm_set_size_hint (f, window_prompting, 0); | |
4881 UNBLOCK_INPUT; | |
4882 | |
4883 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean); | |
4884 f->no_split = minibuffer_only || EQ (tem, Qt); | |
4885 | |
4886 UNGCPRO; | |
4887 | |
4888 /* It is now ok to make the frame official | |
4889 even if we get an error below. | |
4890 And the frame needs to be on Vframe_list | |
4891 or making it visible won't work. */ | |
4892 Vframe_list = Fcons (frame, Vframe_list); | |
4893 | |
4894 /* Now that the frame is official, it counts as a reference to | |
4895 its display. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4896 FRAME_W32_DISPLAY_INFO (f)->reference_count++; |
13434 | 4897 |
4898 /* Make the window appear on the frame and enable display, | |
4899 unless the caller says not to. However, with explicit parent, | |
4900 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
|
4901 if (! f->output_data.w32->explicit_parent) |
13434 | 4902 { |
4903 Lisp_Object visibility; | |
4904 | |
4905 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol); | |
4906 if (EQ (visibility, Qunbound)) | |
4907 visibility = Qt; | |
4908 | |
4909 if (EQ (visibility, Qicon)) | |
4910 x_iconify_frame (f); | |
4911 else if (! NILP (visibility)) | |
4912 x_make_frame_visible (f); | |
4913 else | |
4914 /* Must have been Qnil. */ | |
4915 ; | |
4916 } | |
4917 | |
4918 return unbind_to (count, frame); | |
4919 } | |
4920 | |
4921 /* FRAME is used only to get a handle on the X display. We don't pass the | |
4922 display info directly because we're called from frame.c, which doesn't | |
4923 know about that structure. */ | |
4924 Lisp_Object | |
4925 x_get_focus_frame (frame) | |
4926 struct frame *frame; | |
4927 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4928 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame); |
13434 | 4929 Lisp_Object xfocus; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4930 if (! dpyinfo->w32_focus_frame) |
13434 | 4931 return Qnil; |
4932 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4933 XSETFRAME (xfocus, dpyinfo->w32_focus_frame); |
13434 | 4934 return xfocus; |
4935 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4936 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4937 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
|
4938 "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
|
4939 (frame) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4940 Lisp_Object frame; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4941 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4942 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
|
4943 return Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4944 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4945 |
13434 | 4946 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
4947 struct font_info *w32_load_bdf_font (struct frame *f, char *fontname, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
4948 int size, char* filename); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
4949 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4950 struct font_info * |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
4951 w32_load_system_font (f,fontname,size) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4952 struct frame *f; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4953 char * fontname; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4954 int size; |
13434 | 4955 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4956 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4957 Lisp_Object font_names; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4958 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4959 /* Get a list of all the fonts that match this name. Once we |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4960 have a list of matching fonts, we compare them against the fonts |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4961 we already have loaded by comparing names. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4962 font_names = w32_list_fonts (f, build_string (fontname), size, 100); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4963 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4964 if (!NILP (font_names)) |
14353 | 4965 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4966 Lisp_Object tail; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4967 int i; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4968 #if 0 /* This code has nasty side effects that cause Emacs to crash. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4969 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4970 /* First check if any are already loaded, as that is cheaper |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4971 than loading another one. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4972 for (i = 0; i < dpyinfo->n_fonts; i++) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4973 for (tail = font_names; CONSP (tail); tail = XCONS (tail)->cdr) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4974 if (!strcmp (dpyinfo->font_table[i].name, |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4975 XSTRING (XCONS (tail)->car)->data) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4976 || !strcmp (dpyinfo->font_table[i].full_name, |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4977 XSTRING (XCONS (tail)->car)->data)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4978 return (dpyinfo->font_table + i); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4979 #endif |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4980 fontname = (char *) XSTRING (XCONS (font_names)->car)->data; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4981 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4982 else |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4983 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4984 /* If EnumFontFamiliesEx was available, we got a full list of |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4985 fonts back so stop now to avoid the possibility of loading a |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4986 random font. If we had to fall back to EnumFontFamilies, the |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4987 list is incomplete, so continue whether the font we want was |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4988 listed or not. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4989 HMODULE gdi32 = GetModuleHandle ("gdi32.dll"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4990 FARPROC enum_font_families_ex |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4991 = GetProcAddress ( gdi32, "EnumFontFamiliesExA"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4992 if (enum_font_families_ex) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4993 return NULL; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
4994 } |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4995 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4996 /* Load the font and add it to the table. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4997 { |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
4998 char *full_name, *encoding; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
4999 XFontStruct *font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5000 struct font_info *fontp; |
14353 | 5001 LOGFONT lf; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5002 BOOL ok; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5003 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5004 if (!fontname || !x_to_w32_font (fontname, &lf)) |
14353 | 5005 return (NULL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5006 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5007 if (!*lf.lfFaceName) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5008 /* If no name was specified for the font, we get a random font |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5009 from CreateFontIndirect - this is not particularly |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5010 desirable, especially since CreateFontIndirect does not |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5011 fill out the missing name in lf, so we never know what we |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5012 ended up with. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5013 return NULL; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5014 |
14353 | 5015 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
|
5016 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5017 /* Set bdf to NULL to indicate that this is a Windows font. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5018 font->bdf = NULL; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5019 |
14353 | 5020 BLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5021 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5022 font->hfont = CreateFontIndirect (&lf); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5023 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5024 if (font->hfont == NULL) |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5025 { |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5026 ok = FALSE; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5027 } |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5028 else |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5029 { |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5030 HDC hdc; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5031 HANDLE oldobj; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5032 |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5033 hdc = GetDC (dpyinfo->root_window); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5034 oldobj = SelectObject (hdc, font->hfont); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5035 ok = GetTextMetrics (hdc, &font->tm); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5036 SelectObject (hdc, oldobj); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5037 ReleaseDC (dpyinfo->root_window, hdc); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5038 } |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5039 |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5040 UNBLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5041 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5042 if (!ok) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5043 { |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5044 w32_unload_font (dpyinfo, font); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5045 return (NULL); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5046 } |
13434 | 5047 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5048 /* Do we need to create the table? */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5049 if (dpyinfo->font_table_size == 0) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5050 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5051 dpyinfo->font_table_size = 16; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5052 dpyinfo->font_table |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5053 = (struct font_info *) xmalloc (dpyinfo->font_table_size |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5054 * sizeof (struct font_info)); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5055 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5056 /* Do we need to grow the table? */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5057 else if (dpyinfo->n_fonts |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5058 >= dpyinfo->font_table_size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5059 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5060 dpyinfo->font_table_size *= 2; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5061 dpyinfo->font_table |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5062 = (struct font_info *) xrealloc (dpyinfo->font_table, |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5063 (dpyinfo->font_table_size |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5064 * sizeof (struct font_info))); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5065 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5066 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5067 fontp = dpyinfo->font_table + dpyinfo->n_fonts; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5068 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5069 /* Now fill in the slots of *FONTP. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5070 BLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5071 fontp->font = font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5072 fontp->font_idx = dpyinfo->n_fonts; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5073 fontp->name = (char *) xmalloc (strlen (fontname) + 1); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5074 bcopy (fontname, fontp->name, strlen (fontname) + 1); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5075 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5076 /* Work out the font's full name. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5077 full_name = (char *)xmalloc (100); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5078 if (full_name && w32_to_x_font (&lf, full_name, 100)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5079 fontp->full_name = full_name; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5080 else |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5081 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5082 /* If all else fails - just use the name we used to load it. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5083 xfree (full_name); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5084 fontp->full_name = fontp->name; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5085 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5086 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5087 fontp->size = FONT_WIDTH (font); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5088 fontp->height = FONT_HEIGHT (font); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5089 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5090 /* The slot `encoding' specifies how to map a character |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5091 code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5092 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F, |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5093 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5094 0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, or |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5095 2:0xA020..0xFF7F). For the moment, we don't know which charset |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5096 uses this font. So, we set informatoin in fontp->encoding[1] |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5097 which is never used by any charset. If mapping can't be |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5098 decided, set FONT_ENCODING_NOT_DECIDED. */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5099 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5100 /* SJIS fonts need to be set to type 4, all others seem to work as |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5101 type FONT_ENCODING_NOT_DECIDED. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5102 encoding = strrchr (fontp->name, '-'); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5103 if (encoding && stricmp (encoding+1, "sjis") == 0) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5104 fontp->encoding[1] = 4; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5105 else |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5106 fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5107 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5108 /* The following three values are set to 0 under W32, which is |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5109 what they get set to if XGetFontProperty fails under X. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5110 fontp->baseline_offset = 0; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5111 fontp->relative_compose = 0; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5112 fontp->default_ascent = 0; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5113 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5114 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5115 dpyinfo->n_fonts++; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5116 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5117 return fontp; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5118 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5119 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5120 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5121 /* Load font named FONTNAME of size SIZE for frame F, and return a |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5122 pointer to the structure font_info while allocating it dynamically. |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5123 If loading fails, return NULL. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5124 struct font_info * |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5125 w32_load_font (f,fontname,size) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5126 struct frame *f; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5127 char * fontname; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5128 int size; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5129 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5130 Lisp_Object bdf_fonts; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5131 struct font_info *retval = NULL; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5132 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5133 bdf_fonts = w32_list_bdf_fonts (build_string (fontname)); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5134 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5135 while (!retval && CONSP (bdf_fonts)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5136 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5137 char *bdf_name, *bdf_file; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5138 Lisp_Object bdf_pair; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5139 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5140 bdf_name = XSTRING (XCONS (bdf_fonts)->car)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5141 bdf_pair = Fassoc (XCONS (bdf_fonts)->car, Vw32_bdf_filename_alist); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5142 bdf_file = XSTRING (XCONS (bdf_pair)->cdr)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5143 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5144 retval = w32_load_bdf_font (f, bdf_name, size, bdf_file); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5145 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5146 bdf_fonts = XCONS (bdf_fonts)->cdr; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5147 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5148 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5149 if (retval) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5150 return retval; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5151 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5152 return w32_load_system_font(f, fontname, size); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5153 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5154 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5155 |
13434 | 5156 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5157 w32_unload_font (dpyinfo, font) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5158 struct w32_display_info *dpyinfo; |
13434 | 5159 XFontStruct * font; |
5160 { | |
5161 if (font) | |
5162 { | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5163 if (font->bdf) w32_free_bdf_font (font->bdf); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5164 |
14353 | 5165 if (font->hfont) DeleteObject(font->hfont); |
13434 | 5166 xfree (font); |
5167 } | |
5168 } | |
5169 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5170 /* The font conversion stuff between x and w32 */ |
13434 | 5171 |
5172 /* X font string is as follows (from faces.el) | |
5173 * (let ((- "[-?]") | |
5174 * (foundry "[^-]+") | |
5175 * (family "[^-]+") | |
5176 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1 | |
5177 * (weight\? "\\([^-]*\\)") ; 1 | |
5178 * (slant "\\([ior]\\)") ; 2 | |
5179 * (slant\? "\\([^-]?\\)") ; 2 | |
5180 * (swidth "\\([^-]*\\)") ; 3 | |
5181 * (adstyle "[^-]*") ; 4 | |
5182 * (pixelsize "[0-9]+") | |
5183 * (pointsize "[0-9][0-9]+") | |
5184 * (resx "[0-9][0-9]+") | |
5185 * (resy "[0-9][0-9]+") | |
5186 * (spacing "[cmp?*]") | |
5187 * (avgwidth "[0-9]+") | |
5188 * (registry "[^-]+") | |
5189 * (encoding "[^-]+") | |
5190 * ) | |
5191 * (setq x-font-regexp | |
5192 * (concat "\\`\\*?[-?*]" | |
5193 * foundry - family - weight\? - slant\? - swidth - adstyle - | |
5194 * pixelsize - pointsize - resx - resy - spacing - registry - | |
5195 * encoding "[-?*]\\*?\\'" | |
5196 * )) | |
5197 * (setq x-font-regexp-head | |
5198 * (concat "\\`[-?*]" foundry - family - weight\? - slant\? | |
5199 * "\\([-*?]\\|\\'\\)")) | |
5200 * (setq x-font-regexp-slant (concat - slant -)) | |
5201 * (setq x-font-regexp-weight (concat - weight -)) | |
5202 * nil) | |
5203 */ | |
5204 | |
5205 #define FONT_START "[-?]" | |
5206 #define FONT_FOUNDRY "[^-]+" | |
5207 #define FONT_FAMILY "\\([^-]+\\)" /* 1 */ | |
5208 #define FONT_WEIGHT "\\(bold\\|demibold\\|medium\\)" /* 2 */ | |
5209 #define FONT_WEIGHT_Q "\\([^-]*\\)" /* 2 */ | |
5210 #define FONT_SLANT "\\([ior]\\)" /* 3 */ | |
5211 #define FONT_SLANT_Q "\\([^-]?\\)" /* 3 */ | |
5212 #define FONT_SWIDTH "\\([^-]*\\)" /* 4 */ | |
5213 #define FONT_ADSTYLE "[^-]*" | |
5214 #define FONT_PIXELSIZE "[^-]*" | |
5215 #define FONT_POINTSIZE "\\([0-9][0-9]+\\|\\*\\)" /* 5 */ | |
5216 #define FONT_RESX "[0-9][0-9]+" | |
5217 #define FONT_RESY "[0-9][0-9]+" | |
5218 #define FONT_SPACING "[cmp?*]" | |
5219 #define FONT_AVGWIDTH "[0-9]+" | |
5220 #define FONT_REGISTRY "[^-]+" | |
5221 #define FONT_ENCODING "[^-]+" | |
5222 | |
5223 #define FONT_REGEXP ("\\`\\*?[-?*]" \ | |
5224 FONT_FOUNDRY "-" \ | |
5225 FONT_FAMILY "-" \ | |
5226 FONT_WEIGHT_Q "-" \ | |
5227 FONT_SLANT_Q "-" \ | |
5228 FONT_SWIDTH "-" \ | |
5229 FONT_ADSTYLE "-" \ | |
5230 FONT_PIXELSIZE "-" \ | |
5231 FONT_POINTSIZE "-" \ | |
5232 "[-?*]\\|\\'") | |
5233 | |
5234 #define FONT_REGEXP_HEAD ("\\`[-?*]" \ | |
5235 FONT_FOUNDRY "-" \ | |
5236 FONT_FAMILY "-" \ | |
5237 FONT_WEIGHT_Q "-" \ | |
5238 FONT_SLANT_Q \ | |
5239 "\\([-*?]\\|\\'\\)") | |
5240 | |
5241 #define FONT_REGEXP_SLANT "-" FONT_SLANT "-" | |
5242 #define FONT_REGEXP_WEIGHT "-" FONT_WEIGHT "-" | |
5243 | |
5244 LONG | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5245 x_to_w32_weight (lpw) |
13434 | 5246 char * lpw; |
5247 { | |
5248 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
|
5249 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5250 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
|
5251 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
|
5252 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
|
5253 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
|
5254 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
|
5255 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
|
5256 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
|
5257 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
|
5258 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
|
5259 else if (stricmp (lpw,"thin") == 0) return FW_THIN; |
13434 | 5260 else |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5261 return FW_DONTCARE; |
13434 | 5262 } |
5263 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5264 |
13434 | 5265 char * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5266 w32_to_x_weight (fnweight) |
13434 | 5267 int fnweight; |
5268 { | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5269 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
|
5270 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
|
5271 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
|
5272 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
|
5273 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
|
5274 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
|
5275 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
|
5276 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
|
5277 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
|
5278 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5279 return "*"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5280 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5281 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5282 LONG |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5283 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
|
5284 char * lpcs; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5285 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5286 if (!lpcs) return (0); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5287 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5288 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5289 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5290 else if (stricmp (lpcs, "ms-symbol") == 0) return SYMBOL_CHARSET; |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5291 else if (stricmp (lpcs, "jis") == 0) return SHIFTJIS_CHARSET; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5292 else if (stricmp (lpcs, "ksc5601.1987") == 0) return HANGEUL_CHARSET; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5293 else if (stricmp (lpcs, "gb2312") == 0) return GB2312_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5294 else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_CHARSET; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5295 else if (stricmp (lpcs, "ms-oem") == 0) return OEM_CHARSET; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5296 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5297 #ifdef EASTEUROPE_CHARSET |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5298 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5299 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5300 else if (stricmp (lpcs, "iso8859-4") == 0) return BALTIC_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5301 else if (stricmp (lpcs, "iso8859-5") == 0) return RUSSIAN_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5302 else if (stricmp (lpcs, "koi8") == 0) return RUSSIAN_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5303 else if (stricmp (lpcs, "iso8859-6") == 0) return ARABIC_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5304 else if (stricmp (lpcs, "iso8859-7") == 0) return GREEK_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5305 else if (stricmp (lpcs, "iso8859-8") == 0) return HEBREW_CHARSET; |
24130
3a271e4c5332
(x_to_w32_charset): Add iso8859-9.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23950
diff
changeset
|
5306 else if (stricmp (lpcs, "iso8859-9") == 0) return TURKISH_CHARSET; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5307 else if (stricmp (lpcs, "viscii") == 0) return VIETNAMESE_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5308 else if (stricmp (lpcs, "vscii") == 0) return VIETNAMESE_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5309 else if (stricmp (lpcs, "tis620") == 0) return THAI_CHARSET; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5310 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5311 else if (stricmp (lpcs, "ksc5601.1992") == 0) return JOHAB_CHARSET; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5312 /* For backwards compatibility with previous 20.4 pretests. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5313 else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5314 else if (stricmp (lpcs, "johab") == 0) return JOHAB_CHARSET; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5315 #endif |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5316 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5317 #ifdef UNICODE_CHARSET |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5318 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5319 else if (stricmp (lpcs, "unicode") == 0) return UNICODE_CHARSET; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5320 #endif |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5321 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
|
5322 else |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5323 return DEFAULT_CHARSET; |
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 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5326 char * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5327 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
|
5328 int fncharset; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5329 { |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5330 static char buf[16]; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5331 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5332 switch (fncharset) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5333 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5334 /* ansi is considered iso8859-1, as most modern ansi fonts are. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5335 case ANSI_CHARSET: return "iso8859-1"; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5336 case DEFAULT_CHARSET: return "ascii-*"; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5337 case SYMBOL_CHARSET: return "ms-symbol"; |
24130
3a271e4c5332
(x_to_w32_charset): Add iso8859-9.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23950
diff
changeset
|
5338 case SHIFTJIS_CHARSET: return "jisx0208-sjis"; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5339 case HANGEUL_CHARSET: return "ksc5601.1987-*"; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5340 case GB2312_CHARSET: return "gb2312-*"; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5341 case CHINESEBIG5_CHARSET: return "big5-*"; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5342 case OEM_CHARSET: return "ms-oem"; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5343 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5344 /* More recent versions of Windows (95 and NT4.0) define more |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5345 character sets. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5346 #ifdef EASTEUROPE_CHARSET |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5347 case EASTEUROPE_CHARSET: return "iso8859-2"; |
24130
3a271e4c5332
(x_to_w32_charset): Add iso8859-9.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23950
diff
changeset
|
5348 case TURKISH_CHARSET: return "iso8859-9"; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5349 case BALTIC_CHARSET: return "iso8859-4"; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5350 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5351 /* W95 with international support but not IE4 often has the |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5352 KOI8-R codepage but not ISO8859-5. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5353 case RUSSIAN_CHARSET: |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5354 if (!IsValidCodePage(28595) && IsValidCodePage(20886)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5355 return "koi8-r"; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5356 else |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5357 return "iso8859-5"; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5358 case ARABIC_CHARSET: return "iso8859-6"; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5359 case GREEK_CHARSET: return "iso8859-7"; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5360 case HEBREW_CHARSET: return "iso8859-8"; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5361 case VIETNAMESE_CHARSET: return "viscii1.1-*"; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5362 case THAI_CHARSET: return "tis620-*"; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5363 case MAC_CHARSET: return "mac-*"; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5364 case JOHAB_CHARSET: return "ksc5601.1992-*"; |
24130
3a271e4c5332
(x_to_w32_charset): Add iso8859-9.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23950
diff
changeset
|
5365 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5366 #endif |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5367 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5368 #ifdef UNICODE_CHARSET |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5369 case UNICODE_CHARSET: return "iso10646-unicode"; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5370 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5371 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5372 /* Encode numerical value of unknown charset. */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5373 sprintf (buf, "*-#%u", fncharset); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5374 return buf; |
13434 | 5375 } |
5376 | |
5377 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5378 w32_to_x_font (lplogfont, lpxstr, len) |
13434 | 5379 LOGFONT * lplogfont; |
5380 char * lpxstr; | |
5381 int len; | |
5382 { | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5383 char fontname[50]; |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5384 char height_pixels[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5385 char height_dpi[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5386 char width_pixels[8]; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5387 char *fontname_dash; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5388 int display_resy = one_w32_display_info.height_in; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5389 int display_resx = one_w32_display_info.width_in; |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5390 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5391 if (!lpxstr) abort (); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5392 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5393 if (!lplogfont) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5394 return FALSE; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5395 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5396 strncpy (fontname, lplogfont->lfFaceName, 50); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5397 fontname[49] = '\0'; /* Just in case */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5398 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5399 /* Replace dashes with underscores so the dashes are not |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5400 misinterpreted */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5401 fontname_dash = fontname; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5402 while (fontname_dash = strchr (fontname_dash, '-')) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5403 *fontname_dash = '_'; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5404 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5405 if (lplogfont->lfHeight) |
13434 | 5406 { |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5407 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5408 sprintf (height_dpi, "%u", |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5409 abs (lplogfont->lfHeight) * 720 / display_resy); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5410 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5411 else |
13434 | 5412 { |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5413 strcpy (height_pixels, "*"); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5414 strcpy (height_dpi, "*"); |
13434 | 5415 } |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5416 if (lplogfont->lfWidth) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5417 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5418 else |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5419 strcpy (width_pixels, "*"); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5420 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5421 _snprintf (lpxstr, len - 1, |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5422 "-*-%s-%s-%c-*-*-%s-%s-%d-%d-%c-%s-%s", |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5423 /* foundry */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5424 fontname, /* family */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5425 w32_to_x_weight (lplogfont->lfWeight), /* weight */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5426 lplogfont->lfItalic?'i':'r', /* slant */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5427 /* setwidth name */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5428 /* add style name */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5429 height_pixels, /* pixel size */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5430 height_dpi, /* point size */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5431 display_resx, /* resx */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5432 display_resy, /* resy */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5433 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5434 ? 'p' : 'c', /* spacing */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5435 width_pixels, /* avg width */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5436 w32_to_x_charset (lplogfont->lfCharSet) /* charset registry |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5437 and encoding*/ |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5438 ); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5439 |
13434 | 5440 lpxstr[len - 1] = 0; /* just to be sure */ |
5441 return (TRUE); | |
5442 } | |
5443 | |
5444 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5445 x_to_w32_font (lpxstr, lplogfont) |
13434 | 5446 char * lpxstr; |
5447 LOGFONT * lplogfont; | |
5448 { | |
5449 if (!lplogfont) return (FALSE); | |
5450 | |
5451 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
|
5452 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5453 /* Set default value for each field. */ |
15380
8b01836a6b06
(x_to_win32_font): Allow any quality fonts.
Richard M. Stallman <rms@gnu.org>
parents:
15377
diff
changeset
|
5454 #if 1 |
13434 | 5455 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS; |
5456 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; | |
5457 lplogfont->lfQuality = DEFAULT_QUALITY; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5458 #else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5459 /* go for maximum quality */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5460 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5461 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5462 lplogfont->lfQuality = PROOF_QUALITY; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5463 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5464 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5465 lplogfont->lfCharSet = DEFAULT_CHARSET; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5466 lplogfont->lfWeight = FW_DONTCARE; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5467 lplogfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5468 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5469 if (!lpxstr) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5470 return FALSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5471 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5472 /* 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
|
5473 * 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
|
5474 * format: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5475 * "<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
|
5476 */ |
13434 | 5477 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5478 if (*lpxstr == '-') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5479 { |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5480 int fields, tem; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5481 char name[50], weight[20], slant, pitch, pixels[10], height[10], |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5482 width[10], resy[10], remainder[20]; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5483 char * encoding; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5484 int dpi = 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
|
5485 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5486 fields = sscanf (lpxstr, |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5487 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%9[^-]-%c-%9[^-]-%19s", |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5488 name, weight, &slant, pixels, height, resy, &pitch, width, remainder); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5489 if (fields == EOF) return (FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5490 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5491 if (fields > 0 && name[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5492 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5493 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
|
5494 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
|
5495 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5496 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5497 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5498 lplogfont->lfFaceName[0] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5499 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5500 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5501 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5502 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5503 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
|
5504 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5505 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5506 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5507 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
|
5508 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
|
5509 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5510 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5511 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5512 if (fields > 0 && pixels[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5513 lplogfont->lfHeight = atoi (pixels); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5514 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5515 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5516 fields--; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5517 if (fields > 0 && resy[0] != '*') |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5518 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5519 tem = atoi (pixels); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5520 if (tem > 0) dpi = tem; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5521 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5522 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5523 if (fields > -1 && lplogfont->lfHeight == 0 && height[0] != '*') |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5524 lplogfont->lfHeight = atoi (height) * dpi / 720; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5525 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5526 if (fields > 0) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5527 lplogfont->lfPitchAndFamily = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5528 (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
|
5529 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5530 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5531 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5532 if (fields > 0 && width[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5533 lplogfont->lfWidth = atoi (width) / 10; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5534 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5535 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5536 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5537 /* Strip the trailing '-' if present. (it shouldn't be, as it |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5538 fails the test against xlfn-tight-regexp in fontset.el). */ |
14353 | 5539 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5540 int len = strlen (remainder); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5541 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
|
5542 remainder[len-1] = 0; |
13434 | 5543 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5544 encoding = remainder; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5545 if (strncmp (encoding, "*-", 2) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5546 encoding += 2; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5547 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
|
5548 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5549 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5550 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5551 int fields; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5552 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
|
5553 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5554 fields = sscanf (lpxstr, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5555 "%99[^:]:%9[^:]:%9[^:]:%19s", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5556 name, height, width, weight); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5557 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5558 if (fields == EOF) return (FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5559 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5560 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5561 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5562 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
|
5563 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
|
5564 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5565 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5566 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5567 lplogfont->lfFaceName[0] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5568 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5569 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5570 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5571 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5572 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5573 lplogfont->lfHeight = atoi (height); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5574 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5575 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5576 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5577 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5578 lplogfont->lfWidth = atoi (width); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5579 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5580 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5581 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5582 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
|
5583 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5584 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5585 /* 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
|
5586 lplogfont->lfHeight = - abs (lplogfont->lfHeight); |
13434 | 5587 |
5588 return (TRUE); | |
5589 } | |
5590 | |
5591 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5592 w32_font_match (lpszfont1, lpszfont2) |
13434 | 5593 char * lpszfont1; |
5594 char * lpszfont2; | |
5595 { | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5596 char * s1 = lpszfont1, *e1, *w1; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5597 char * s2 = lpszfont2, *e2, *w2; |
13434 | 5598 |
5599 if (s1 == NULL || s2 == NULL) return (FALSE); | |
5600 | |
5601 if (*s1 == '-') s1++; | |
5602 if (*s2 == '-') s2++; | |
5603 | |
5604 while (1) | |
5605 { | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5606 int len1, len2, len3=0; |
13434 | 5607 |
5608 e1 = strchr (s1, '-'); | |
5609 e2 = strchr (s2, '-'); | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5610 w1 = strchr (s1, '*'); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5611 w2 = strchr (s2, '*'); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5612 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5613 if (e1 == NULL) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5614 len1 = strlen (s1); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5615 else |
13434 | 5616 len1 = e1 - s1; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5617 if (e2 == NULL) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5618 len2 = strlen (s1); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5619 else |
13434 | 5620 len2 = e2 - s2; |
5621 | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5622 if (w1 && w1 < e1) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5623 len3 = w1 - s1; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5624 if (w2 && w2 < e2 && ( len3 == 0 || (w2 - s2) < len3)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5625 len3 = w2 - s2; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5626 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5627 /* Whole field is not a wildcard, and ...*/ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5628 if (*s1 != '*' && *s2 != '*' && *s1 != '-' && *s2 != '-' |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5629 /* Lengths are different and there are no wildcards, or ... */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5630 && ((len1 != len2 && len3 == 0) || |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5631 /* strings don't match up until first wildcard or end. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5632 strnicmp (s1, s2, len3 > 0 ? len3 : len1) != 0)) |
13434 | 5633 return (FALSE); |
5634 | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5635 if (e1 == NULL || e2 == NULL) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5636 return (TRUE); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5637 |
13434 | 5638 s1 = e1 + 1; |
5639 s2 = e2 + 1; | |
5640 } | |
5641 } | |
5642 | |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5643 /* Callback functions, and a structure holding info they need, for |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5644 listing system fonts on W32. We need one set of functions to do the |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5645 job properly, but these don't work on NT 3.51 and earlier, so we |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5646 have a second set which don't handle character sets properly to |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5647 fall back on. |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5648 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5649 In both cases, there are two passes made. The first pass gets one |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5650 font from each family, the second pass lists all the fonts from |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5651 each family. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5652 |
13434 | 5653 typedef struct enumfont_t |
5654 { | |
5655 HDC hdc; | |
5656 int numFonts; | |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5657 LOGFONT logfont; |
13434 | 5658 XFontStruct *size_ref; |
5659 Lisp_Object *pattern; | |
5660 Lisp_Object *tail; | |
5661 } enumfont_t; | |
5662 | |
5663 int CALLBACK | |
5664 enum_font_cb2 (lplf, lptm, FontType, lpef) | |
5665 ENUMLOGFONT * lplf; | |
5666 NEWTEXTMETRIC * lptm; | |
5667 int FontType; | |
5668 enumfont_t * lpef; | |
5669 { | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5670 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline) |
13434 | 5671 return (1); |
5672 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5673 /* Check that the character set matches if it was specified */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5674 if (lpef->logfont.lfCharSet != DEFAULT_CHARSET && |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5675 lplf->elfLogFont.lfCharSet != lpef->logfont.lfCharSet) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5676 return (1); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5677 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5678 /* We want all fonts cached, so don't compare sizes just yet */ |
13434 | 5679 /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */ |
5680 { | |
5681 char buf[100]; | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5682 Lisp_Object width = Qnil; |
13434 | 5683 |
21896
ff66bfc5d801
(enum_font_cb2): Only ignore raster fonts when
Geoff Voelker <voelker@cs.washington.edu>
parents:
21884
diff
changeset
|
5684 if (!NILP (*(lpef->pattern)) && FontType != RASTER_FONTTYPE) |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5685 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5686 /* Scalable fonts are as big as you want them to be. */ |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5687 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5688 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5689 } |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
5690 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5691 /* The MaxCharWidth is not valid at this stage for scalable fonts. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5692 if (FontType == RASTER_FONTTYPE) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5693 width = make_number (lptm->tmMaxCharWidth); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5694 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5695 if (!w32_to_x_font (&(lplf->elfLogFont), buf, 100)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5696 return (0); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5697 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5698 if (NILP (*(lpef->pattern)) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5699 || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) |
13434 | 5700 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5701 *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5702 lpef->tail = &(XCONS (*lpef->tail)->cdr); |
13434 | 5703 lpef->numFonts++; |
5704 } | |
5705 } | |
5706 | |
5707 return (1); | |
5708 } | |
5709 | |
5710 int CALLBACK | |
5711 enum_font_cb1 (lplf, lptm, FontType, lpef) | |
5712 ENUMLOGFONT * lplf; | |
5713 NEWTEXTMETRIC * lptm; | |
5714 int FontType; | |
5715 enumfont_t * lpef; | |
5716 { | |
5717 return EnumFontFamilies (lpef->hdc, | |
5718 lplf->elfLogFont.lfFaceName, | |
5719 (FONTENUMPROC) enum_font_cb2, | |
5720 (LPARAM) lpef); | |
5721 } | |
5722 | |
5723 | |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5724 int CALLBACK |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5725 enum_fontex_cb2 (lplf, lptm, font_type, lpef) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5726 ENUMLOGFONTEX * lplf; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5727 NEWTEXTMETRICEX * lptm; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5728 int font_type; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5729 enumfont_t * lpef; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5730 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5731 /* We are not interested in the extra info we get back from the 'Ex |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5732 version - only the fact that we get character set variations |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5733 enumerated seperately. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5734 return enum_font_cb2 ((ENUMLOGFONT *) lplf, (NEWTEXTMETRIC *) lptm, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5735 font_type, lpef); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5736 } |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5737 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5738 int CALLBACK |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5739 enum_fontex_cb1 (lplf, lptm, font_type, lpef) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5740 ENUMLOGFONTEX * lplf; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5741 NEWTEXTMETRICEX * lptm; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5742 int font_type; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5743 enumfont_t * lpef; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5744 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5745 HMODULE gdi32 = GetModuleHandle ("gdi32.dll"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5746 FARPROC enum_font_families_ex |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5747 = GetProcAddress ( gdi32, "EnumFontFamiliesExA"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5748 /* We don't really expect EnumFontFamiliesEx to disappear once we |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5749 get here, so don't bother handling it gracefully. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5750 if (enum_font_families_ex == NULL) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5751 error ("gdi32.dll has disappeared!"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5752 return enum_font_families_ex (lpef->hdc, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5753 &lplf->elfLogFont, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5754 (FONTENUMPROC) enum_fontex_cb2, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5755 (LPARAM) lpef, 0); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5756 } |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5757 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5758 /* Interface to fontset handler. (adapted from mw32font.c in Meadow |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5759 and xterm.c in Emacs 20.3) */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5760 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5761 Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5762 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5763 char *fontname, *ptnstr; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5764 Lisp_Object list, tem, newlist = Qnil; |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5765 int n_fonts; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5766 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5767 list = Vw32_bdf_filename_alist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5768 ptnstr = XSTRING (pattern)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5769 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5770 for ( ; CONSP (list); list = XCONS (list)->cdr) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5771 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5772 tem = XCONS (list)->car; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5773 if (CONSP (tem)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5774 fontname = XSTRING (XCONS (tem)->car)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5775 else if (STRINGP (tem)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5776 fontname = XSTRING (tem)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5777 else |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5778 continue; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5779 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5780 if (w32_font_match (fontname, ptnstr)) |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5781 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5782 newlist = Fcons (XCONS (tem)->car, newlist); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5783 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5784 if (n_fonts >= max_names) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5785 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5786 } |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5787 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5788 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5789 return newlist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5790 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5791 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5792 Lisp_Object w32_list_synthesized_fonts (FRAME_PTR f, Lisp_Object pattern, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5793 int size, int max_names); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5794 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5795 /* Return a list of names of available fonts matching PATTERN on frame |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5796 F. If SIZE is not 0, it is the size (maximum bound width) of fonts |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5797 to be listed. Frame F NULL means we have not yet created any |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5798 frame, which means we can't get proper size info, as we don't have |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5799 a device context to use for GetTextMetrics. |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5800 MAXNAMES sets a limit on how many fonts to match. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5801 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5802 Lisp_Object |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5803 w32_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames ) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5804 { |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5805 Lisp_Object patterns, key, tem, tpat; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5806 Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5807 struct w32_display_info *dpyinfo = &one_w32_display_info; |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5808 int n_fonts = 0; |
23637
54b22e0a1f7b
(w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents:
23620
diff
changeset
|
5809 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5810 patterns = Fassoc (pattern, Valternate_fontname_alist); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5811 if (NILP (patterns)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5812 patterns = Fcons (pattern, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5813 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5814 for (; CONSP (patterns); patterns = XCONS (patterns)->cdr) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5815 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5816 enumfont_t ef; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5817 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5818 tpat = XCONS (patterns)->car; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5819 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5820 /* See if we cached the result for this particular query. |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5821 The cache is an alist of the form: |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5822 ((PATTERN (FONTNAME . WIDTH) ...) ...) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5823 */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5824 if (tem = XCONS (dpyinfo->name_list_element)->cdr, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5825 !NILP (list = Fassoc (tpat, tem))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5826 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5827 list = Fcdr_safe (list); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5828 /* We have a cached list. Don't have to get the list again. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5829 goto label_cached; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5830 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5831 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5832 BLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5833 /* At first, put PATTERN in the cache. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5834 list = Qnil; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5835 ef.pattern = &tpat; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5836 ef.tail = &list; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5837 ef.numFonts = 0; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5838 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5839 /* Use EnumFontFamiliesEx where it is available, as it knows |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5840 about character sets. Fall back to EnumFontFamilies for |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5841 older versions of NT that don't support the 'Ex function. */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5842 x_to_w32_font (STRINGP (tpat) ? XSTRING (tpat)->data : |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5843 NULL, &ef.logfont); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5844 { |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5845 LOGFONT font_match_pattern; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5846 HMODULE gdi32 = GetModuleHandle ("gdi32.dll"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5847 FARPROC enum_font_families_ex |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5848 = GetProcAddress ( gdi32, "EnumFontFamiliesExA"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5849 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5850 /* We do our own pattern matching so we can handle wildcards. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5851 font_match_pattern.lfFaceName[0] = 0; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5852 font_match_pattern.lfPitchAndFamily = 0; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5853 /* We can use the charset, because if it is a wildcard it will |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5854 be DEFAULT_CHARSET anyway. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5855 font_match_pattern.lfCharSet = ef.logfont.lfCharSet; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5856 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5857 ef.hdc = GetDC (dpyinfo->root_window); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5858 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5859 if (enum_font_families_ex) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5860 enum_font_families_ex (ef.hdc, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5861 &font_match_pattern, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5862 (FONTENUMPROC) enum_fontex_cb1, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5863 (LPARAM) &ef, 0); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5864 else |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5865 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5866 (LPARAM)&ef); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5867 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5868 ReleaseDC (dpyinfo->root_window, ef.hdc); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5869 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5870 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5871 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5872 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5873 /* Make a list of the fonts we got back. |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5874 Store that in the font cache for the display. */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5875 XCONS (dpyinfo->name_list_element)->cdr |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5876 = Fcons (Fcons (tpat, list), |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5877 XCONS (dpyinfo->name_list_element)->cdr); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5878 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5879 label_cached: |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5880 if (NILP (list)) continue; /* Try the remaining alternatives. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5881 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5882 newlist = second_best = Qnil; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5883 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5884 /* Make a list of the fonts that have the right width. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5885 for (; CONSP (list); list = XCONS (list)->cdr) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5886 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5887 int found_size; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5888 tem = XCONS (list)->car; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5889 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5890 if (!CONSP (tem)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5891 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5892 if (NILP (XCONS (tem)->car)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5893 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5894 if (!size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5895 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5896 newlist = Fcons (XCONS (tem)->car, newlist); |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5897 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5898 if (n_fonts >= maxnames) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5899 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5900 else |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5901 continue; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5902 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5903 if (!INTEGERP (XCONS (tem)->cdr)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5904 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5905 /* Since we don't yet know the size of the font, we must |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5906 load it and try GetTextMetrics. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5907 W32FontStruct thisinfo; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5908 LOGFONT lf; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5909 HDC hdc; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5910 HANDLE oldobj; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5911 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5912 if (!x_to_w32_font (XSTRING (XCONS (tem)->car)->data, &lf)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5913 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5914 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5915 BLOCK_INPUT; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5916 thisinfo.bdf = NULL; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5917 thisinfo.hfont = CreateFontIndirect (&lf); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5918 if (thisinfo.hfont == NULL) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5919 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5920 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5921 hdc = GetDC (dpyinfo->root_window); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5922 oldobj = SelectObject (hdc, thisinfo.hfont); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5923 if (GetTextMetrics (hdc, &thisinfo.tm)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5924 XCONS (tem)->cdr = make_number (FONT_WIDTH (&thisinfo)); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5925 else |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5926 XCONS (tem)->cdr = make_number (0); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5927 SelectObject (hdc, oldobj); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5928 ReleaseDC (dpyinfo->root_window, hdc); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5929 DeleteObject(thisinfo.hfont); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5930 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5931 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5932 found_size = XINT (XCONS (tem)->cdr); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5933 if (found_size == size) |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5934 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5935 newlist = Fcons (XCONS (tem)->car, newlist); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5936 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5937 if (n_fonts >= maxnames) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5938 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5939 } |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5940 /* keep track of the closest matching size in case |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5941 no exact match is found. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5942 else if (found_size > 0) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5943 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5944 if (NILP (second_best)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5945 second_best = tem; |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5946 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5947 else if (found_size < size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5948 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5949 if (XINT (XCONS (second_best)->cdr) > size |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5950 || XINT (XCONS (second_best)->cdr) < found_size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5951 second_best = tem; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5952 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5953 else |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5954 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5955 if (XINT (XCONS (second_best)->cdr) > size |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5956 && XINT (XCONS (second_best)->cdr) > |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5957 found_size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5958 second_best = tem; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5959 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5960 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5961 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5962 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5963 if (!NILP (newlist)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5964 break; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5965 else if (!NILP (second_best)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5966 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5967 newlist = Fcons (XCONS (second_best)->car, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5968 break; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5969 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5970 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5971 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5972 /* Include any bdf fonts. */ |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5973 if (n_fonts < maxnames) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5974 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5975 Lisp_Object combined[2]; |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5976 combined[0] = w32_list_bdf_fonts (pattern, maxnames - n_fonts); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5977 combined[1] = newlist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5978 newlist = Fnconc(2, combined); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5979 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5980 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5981 /* If we can't find a font that matches, check if Windows would be |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5982 able to synthesize it from a different style. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5983 if (NILP (newlist) && !NILP (Vw32_enable_italics)) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5984 newlist = w32_list_synthesized_fonts (f, pattern, size, maxnames); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5985 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5986 return newlist; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5987 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5988 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5989 Lisp_Object |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5990 w32_list_synthesized_fonts (f, pattern, size, max_names) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5991 FRAME_PTR f; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5992 Lisp_Object pattern; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5993 int size; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5994 int max_names; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5995 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5996 int fields; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5997 char *full_pattn, *new_pattn, foundary[50], family[50], *pattn_part2; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5998 char style[20], slant; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5999 Lisp_Object matches, match, tem, synthed_matches = Qnil; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6000 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6001 full_pattn = XSTRING (pattern)->data; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6002 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6003 pattn_part2 = alloca (XSTRING (pattern)->size); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6004 /* Allow some space for wildcard expansion. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6005 new_pattn = alloca (XSTRING (pattern)->size + 100); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6006 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6007 fields = sscanf (full_pattn, "-%49[^-]-%49[^-]-%19[^-]-%c-%s", |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6008 foundary, family, style, &slant, pattn_part2); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6009 if (fields == EOF || fields < 5) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6010 return Qnil; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6011 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6012 /* If the style and slant are wildcards already there is no point |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6013 checking again (and we don't want to keep recursing). */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6014 if (*style == '*' && slant == '*') |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6015 return Qnil; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6016 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6017 sprintf (new_pattn, "-%s-%s-*-*-%s", foundary, family, pattn_part2); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6018 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6019 matches = w32_list_fonts (f, build_string (new_pattn), size, max_names); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6020 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6021 for ( ; CONSP (matches); matches = XCONS (matches)->cdr) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6022 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6023 tem = XCONS (matches)->car; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6024 if (!STRINGP (tem)) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6025 continue; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6026 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6027 full_pattn = XSTRING (tem)->data; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6028 fields = sscanf (full_pattn, "-%49[^-]-%49[^-]-%*[^-]-%*c-%s", |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6029 foundary, family, pattn_part2); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6030 if (fields == EOF || fields < 3) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6031 continue; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6032 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6033 sprintf (new_pattn, "-%s-%s-%s-%c-%s", foundary, family, style, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6034 slant, pattn_part2); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6035 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6036 synthed_matches = Fcons (build_string (new_pattn), |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6037 synthed_matches); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6038 } |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6039 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6040 return synthed_matches; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6041 } |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6042 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6043 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6044 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6045 struct font_info * |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6046 w32_get_font_info (f, font_idx) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6047 FRAME_PTR f; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6048 int font_idx; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6049 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6050 return (FRAME_W32_FONT_TABLE (f) + font_idx); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6051 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6052 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6053 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6054 struct font_info* |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6055 w32_query_font (struct frame *f, char *fontname) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6056 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6057 int i; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6058 struct font_info *pfi; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6059 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6060 pfi = FRAME_W32_FONT_TABLE (f); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6061 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6062 for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6063 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6064 if (strcmp(pfi->name, fontname) == 0) return pfi; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6065 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6066 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6067 return NULL; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6068 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6069 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6070 /* Find a CCL program for a font specified by FONTP, and set the member |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6071 `encoder' of the structure. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6072 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6073 void |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6074 w32_find_ccl_program (fontp) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6075 struct font_info *fontp; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6076 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6077 extern Lisp_Object Vfont_ccl_encoder_alist, Vccl_program_table; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6078 extern Lisp_Object Qccl_program_idx; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6079 extern Lisp_Object resolve_symbol_ccl_program (); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6080 Lisp_Object list, elt, ccl_prog, ccl_id; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6081 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6082 for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCONS (list)->cdr) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6083 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6084 elt = XCONS (list)->car; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6085 if (CONSP (elt) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6086 && STRINGP (XCONS (elt)->car) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6087 && (fast_c_string_match_ignore_case (XCONS (elt)->car, fontp->name) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6088 >= 0)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6089 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6090 if (SYMBOLP (XCONS (elt)->cdr) && |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6091 (!NILP (ccl_id = Fget (XCONS (elt)->cdr, Qccl_program_idx)))) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6092 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6093 ccl_prog = XVECTOR (Vccl_program_table)->contents[XUINT (ccl_id)]; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6094 if (!CONSP (ccl_prog)) continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6095 ccl_prog = XCONS (ccl_prog)->cdr; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6096 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6097 else |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6098 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6099 ccl_prog = XCONS (elt)->cdr; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6100 if (!VECTORP (ccl_prog)) continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6101 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6102 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6103 fontp->font_encoder |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6104 = (struct ccl_program *) xmalloc (sizeof (struct ccl_program)); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6105 setup_ccl_program (fontp->font_encoder, |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6106 resolve_symbol_ccl_program (ccl_prog)); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6107 break; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6108 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6109 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6110 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6111 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6112 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6113 #if 1 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6114 #include "x-list-font.c" |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6115 #else |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
6116 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 4, 0, |
13434 | 6117 "Return a list of the names of available fonts matching PATTERN.\n\ |
6118 If optional arguments FACE and FRAME are specified, return only fonts\n\ | |
6119 the same size as FACE on FRAME.\n\ | |
6120 \n\ | |
6121 PATTERN is a string, perhaps with wildcard characters;\n\ | |
6122 the * character matches any substring, and\n\ | |
6123 the ? character matches any single character.\n\ | |
6124 PATTERN is case-insensitive.\n\ | |
6125 FACE is a face name--a symbol.\n\ | |
6126 \n\ | |
6127 The return value is a list of strings, suitable as arguments to\n\ | |
6128 set-face-font.\n\ | |
6129 \n\ | |
6130 Fonts Emacs can't use (i.e. proportional fonts) may or may not be excluded\n\ | |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
6131 even if they match PATTERN and FACE.\n\ |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
6132 \n\ |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
6133 The optional fourth argument MAXIMUM sets a limit on how many\n\ |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
6134 fonts to match. The first MAXIMUM fonts are reported.") |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
6135 (pattern, face, frame, maximum) |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
6136 Lisp_Object pattern, face, frame, maximum; |
13434 | 6137 { |
6138 int num_fonts; | |
6139 char **names; | |
6140 XFontStruct *info; | |
6141 XFontStruct *size_ref; | |
6142 Lisp_Object namelist; | |
6143 Lisp_Object list; | |
6144 FRAME_PTR f; | |
6145 enumfont_t ef; | |
6146 | |
6147 CHECK_STRING (pattern, 0); | |
6148 if (!NILP (face)) | |
6149 CHECK_SYMBOL (face, 1); | |
6150 | |
6151 f = check_x_frame (frame); | |
6152 | |
6153 /* Determine the width standard for comparison with the fonts we find. */ | |
6154 | |
6155 if (NILP (face)) | |
6156 size_ref = 0; | |
6157 else | |
6158 { | |
6159 int face_id; | |
6160 | |
6161 /* 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
|
6162 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6163 error ("non-w32 frame used in `x-list-fonts'"); |
13434 | 6164 |
6165 face_id = face_name_id_number (f, face); | |
6166 | |
6167 if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f) | |
6168 || 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
|
6169 size_ref = f->output_data.w32->font; |
13434 | 6170 else |
6171 { | |
6172 size_ref = FRAME_PARAM_FACES (f) [face_id]->font; | |
6173 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
|
6174 size_ref = f->output_data.w32->font; |
13434 | 6175 } |
6176 } | |
6177 | |
6178 /* See if we cached the result for this particular query. */ | |
6179 list = Fassoc (pattern, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6180 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr); |
13434 | 6181 |
6182 /* We have info in the cache for this PATTERN. */ | |
6183 if (!NILP (list)) | |
6184 { | |
6185 Lisp_Object tem, newlist; | |
6186 | |
6187 /* We have info about this pattern. */ | |
6188 list = XCONS (list)->cdr; | |
6189 | |
6190 if (size_ref == 0) | |
6191 return list; | |
6192 | |
6193 BLOCK_INPUT; | |
6194 | |
6195 /* Filter the cached info and return just the fonts that match FACE. */ | |
6196 newlist = Qnil; | |
6197 for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr) | |
6198 { | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6199 struct font_info *fontinf; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6200 XFontStruct *thisinfo = NULL; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6201 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6202 fontinf = w32_load_font (f, XSTRING (XCONS (tem)->car)->data, 0); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6203 if (fontinf) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6204 thisinfo = (XFontStruct *)fontinf->font; |
13434 | 6205 if (thisinfo && same_size_fonts (thisinfo, size_ref)) |
6206 newlist = Fcons (XCONS (tem)->car, newlist); | |
6207 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6208 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo); |
13434 | 6209 } |
6210 | |
6211 UNBLOCK_INPUT; | |
6212 | |
6213 return newlist; | |
6214 } | |
6215 | |
6216 BLOCK_INPUT; | |
6217 | |
6218 namelist = Qnil; | |
6219 ef.pattern = &pattern; | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6220 ef.tail &namelist; |
13434 | 6221 ef.numFonts = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6222 x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont); |
13434 | 6223 |
6224 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6225 ef.hdc = GetDC (FRAME_W32_WINDOW (f)); |
13434 | 6226 |
6227 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, (LPARAM)&ef); | |
6228 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6229 ReleaseDC (FRAME_W32_WINDOW (f), ef.hdc); |
13434 | 6230 } |
6231 | |
6232 UNBLOCK_INPUT; | |
6233 | |
6234 if (ef.numFonts) | |
6235 { | |
6236 int i; | |
6237 Lisp_Object cur; | |
6238 | |
6239 /* Make a list of all the fonts we got back. | |
6240 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
|
6241 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr |
13434 | 6242 = Fcons (Fcons (pattern, namelist), |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6243 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr); |
13434 | 6244 |
6245 /* Make a list of the fonts that have the right width. */ | |
6246 list = Qnil; | |
6247 cur=namelist; | |
6248 for (i = 0; i < ef.numFonts; i++) | |
6249 { | |
6250 int keeper; | |
6251 | |
6252 if (!size_ref) | |
6253 keeper = 1; | |
6254 else | |
6255 { | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6256 struct font_info *fontinf; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6257 XFontStruct *thisinfo = NULL; |
13434 | 6258 |
6259 BLOCK_INPUT; | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6260 fontinf = w32_load_font (f, XSTRING (Fcar (cur))->data, 0); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6261 if (fontinf) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6262 thisinfo = (XFontStruct *)fontinf->font; |
13434 | 6263 |
6264 keeper = thisinfo && same_size_fonts (thisinfo, size_ref); | |
6265 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6266 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo); |
13434 | 6267 |
6268 UNBLOCK_INPUT; | |
6269 } | |
6270 if (keeper) | |
6271 list = Fcons (build_string (XSTRING (Fcar (cur))->data), list); | |
6272 | |
6273 cur = Fcdr (cur); | |
6274 } | |
6275 list = Fnreverse (list); | |
6276 } | |
6277 | |
6278 return list; | |
6279 } | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6280 #endif |
13434 | 6281 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6282 DEFUN ("w32-find-bdf-fonts", Fw32_find_bdf_fonts, Sw32_find_bdf_fonts, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6283 1, 1, 0, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6284 "Return a list of BDF fonts in DIR, suitable for appending to\n\ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6285 w32-bdf-filename-alist. Fonts which do not contain an xfld description\n\ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6286 will not be included in the list. DIR may be a list of directories.") |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6287 (directory) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6288 Lisp_Object directory; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6289 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6290 Lisp_Object list = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6291 struct gcpro gcpro1, gcpro2; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6292 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6293 if (!CONSP (directory)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6294 return w32_find_bdf_fonts_in_dir (directory); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6295 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6296 for ( ; CONSP (directory); directory = XCONS (directory)->cdr) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6297 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6298 Lisp_Object pair[2]; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6299 pair[0] = list; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6300 pair[1] = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6301 GCPRO2 (directory, list); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6302 pair[1] = w32_find_bdf_fonts_in_dir( XCONS (directory)->car ); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6303 list = Fnconc( 2, pair ); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6304 UNGCPRO; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6305 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6306 return list; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6307 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6308 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6309 /* Find BDF files in a specified directory. (use GCPRO when calling, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6310 as this calls lisp to get a directory listing). */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6311 Lisp_Object w32_find_bdf_fonts_in_dir( Lisp_Object directory ) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6312 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6313 Lisp_Object filelist, list = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6314 char fontname[100]; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6315 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6316 if (!STRINGP(directory)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6317 return Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6318 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6319 filelist = Fdirectory_files (directory, Qt, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6320 build_string (".*\\.[bB][dD][fF]"), Qt); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6321 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6322 for ( ; CONSP(filelist); filelist = XCONS (filelist)->cdr) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6323 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6324 Lisp_Object filename = XCONS (filelist)->car; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6325 if (w32_BDF_to_x_font (XSTRING (filename)->data, fontname, 100)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6326 store_in_alist (&list, build_string (fontname), filename); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6327 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6328 return list; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6329 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6330 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6331 |
13434 | 6332 DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, |
6333 "Return non-nil if color COLOR is supported on frame FRAME.\n\ | |
6334 If FRAME is omitted or nil, use the selected frame.") | |
6335 (color, frame) | |
6336 Lisp_Object color, frame; | |
6337 { | |
6338 COLORREF foo; | |
6339 FRAME_PTR f = check_x_frame (frame); | |
6340 | |
6341 CHECK_STRING (color, 1); | |
6342 | |
6343 if (defined_color (f, XSTRING (color)->data, &foo, 0)) | |
6344 return Qt; | |
6345 else | |
6346 return Qnil; | |
6347 } | |
6348 | |
6349 DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0, | |
6350 "Return a description of the color named COLOR on frame FRAME.\n\ | |
6351 The value is a list of integer RGB values--(RED GREEN BLUE).\n\ | |
6352 These values appear to range from 0 to 65280 or 65535, depending\n\ | |
6353 on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\ | |
6354 If FRAME is omitted or nil, use the selected frame.") | |
6355 (color, frame) | |
6356 Lisp_Object color, frame; | |
6357 { | |
6358 COLORREF foo; | |
6359 FRAME_PTR f = check_x_frame (frame); | |
6360 | |
6361 CHECK_STRING (color, 1); | |
6362 | |
6363 if (defined_color (f, XSTRING (color)->data, &foo, 0)) | |
6364 { | |
6365 Lisp_Object rgb[3]; | |
6366 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6367 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
|
6368 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
|
6369 rgb[2] = make_number ((GetBValue (foo) << 8) | GetBValue (foo)); |
13434 | 6370 return Flist (3, rgb); |
6371 } | |
6372 else | |
6373 return Qnil; | |
6374 } | |
6375 | |
6376 DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0, | |
6377 "Return t if the X display supports color.\n\ | |
6378 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6379 DISPLAY should be either a frame or a display name (a string).\n\ | |
6380 If omitted or nil, that stands for the selected frame's display.") | |
6381 (display) | |
6382 Lisp_Object display; | |
6383 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6384 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6385 |
6386 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2) | |
6387 return Qnil; | |
6388 | |
6389 return Qt; | |
6390 } | |
6391 | |
6392 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, | |
6393 0, 1, 0, | |
6394 "Return t if the X display supports shades of gray.\n\ | |
6395 Note that color displays do support shades of gray.\n\ | |
6396 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6397 DISPLAY should be either a frame or a display name (a string).\n\ | |
6398 If omitted or nil, that stands for the selected frame's display.") | |
6399 (display) | |
6400 Lisp_Object display; | |
6401 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6402 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6403 |
6404 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1) | |
6405 return Qnil; | |
6406 | |
6407 return Qt; | |
6408 } | |
6409 | |
6410 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, | |
6411 0, 1, 0, | |
6412 "Returns the width in pixels of the X display DISPLAY.\n\ | |
6413 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6414 DISPLAY should be either a frame or a display name (a string).\n\ | |
6415 If omitted or nil, that stands for the selected frame's display.") | |
6416 (display) | |
6417 Lisp_Object display; | |
6418 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6419 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6420 |
6421 return make_number (dpyinfo->width); | |
6422 } | |
6423 | |
6424 DEFUN ("x-display-pixel-height", Fx_display_pixel_height, | |
6425 Sx_display_pixel_height, 0, 1, 0, | |
6426 "Returns the height in pixels of the X display DISPLAY.\n\ | |
6427 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6428 DISPLAY should be either a frame or a display name (a string).\n\ | |
6429 If omitted or nil, that stands for the selected frame's display.") | |
6430 (display) | |
6431 Lisp_Object display; | |
6432 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6433 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6434 |
6435 return make_number (dpyinfo->height); | |
6436 } | |
6437 | |
6438 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, | |
6439 0, 1, 0, | |
6440 "Returns the number of bitplanes of the display DISPLAY.\n\ | |
6441 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6442 DISPLAY should be either a frame or a display name (a string).\n\ | |
6443 If omitted or nil, that stands for the selected frame's display.") | |
6444 (display) | |
6445 Lisp_Object display; | |
6446 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6447 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6448 |
6449 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits); | |
6450 } | |
6451 | |
6452 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, | |
6453 0, 1, 0, | |
6454 "Returns the number of color cells of the display DISPLAY.\n\ | |
6455 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6456 DISPLAY should be either a frame or a display name (a string).\n\ | |
6457 If omitted or nil, that stands for the selected frame's display.") | |
6458 (display) | |
6459 Lisp_Object display; | |
6460 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6461 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6462 HDC hdc; |
6463 int cap; | |
6464 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6465 hdc = GetDC (dpyinfo->root_window); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6466 if (dpyinfo->has_palette) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6467 cap = GetDeviceCaps (hdc,SIZEPALETTE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6468 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6469 cap = GetDeviceCaps (hdc,NUMCOLORS); |
13434 | 6470 |
6471 ReleaseDC (dpyinfo->root_window, hdc); | |
6472 | |
6473 return make_number (cap); | |
6474 } | |
6475 | |
6476 DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |
6477 Sx_server_max_request_size, | |
6478 0, 1, 0, | |
6479 "Returns the maximum request size of the server of display DISPLAY.\n\ | |
6480 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6481 DISPLAY should be either a frame or a display name (a string).\n\ | |
6482 If omitted or nil, that stands for the selected frame's display.") | |
6483 (display) | |
6484 Lisp_Object display; | |
6485 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6486 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6487 |
6488 return make_number (1); | |
6489 } | |
6490 | |
6491 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
|
6492 "Returns the vendor ID string of the W32 system (Microsoft).\n\ |
13434 | 6493 The optional argument DISPLAY specifies which display to ask about.\n\ |
6494 DISPLAY should be either a frame or a display name (a string).\n\ | |
6495 If omitted or nil, that stands for the selected frame's display.") | |
6496 (display) | |
6497 Lisp_Object display; | |
6498 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6499 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6500 char *vendor = "Microsoft Corp."; |
6501 | |
6502 if (! vendor) vendor = ""; | |
6503 return build_string (vendor); | |
6504 } | |
6505 | |
6506 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, | |
6507 "Returns the version numbers of the server of display DISPLAY.\n\ | |
6508 The value is a list of three integers: the major and minor\n\ | |
6509 version numbers, and the vendor-specific release\n\ | |
6510 number. See also the function `x-server-vendor'.\n\n\ | |
6511 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6512 DISPLAY should be either a frame or a display name (a string).\n\ | |
6513 If omitted or nil, that stands for the selected frame's display.") | |
6514 (display) | |
6515 Lisp_Object display; | |
6516 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6517 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
|
6518 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6519 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
|
6520 Fcons (make_number (w32_minor_version), Qnil)); |
13434 | 6521 } |
6522 | |
6523 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, | |
6524 "Returns the number of screens on the server of display DISPLAY.\n\ | |
6525 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6526 DISPLAY should be either a frame or a display name (a string).\n\ | |
6527 If omitted or nil, that stands for the selected frame's display.") | |
6528 (display) | |
6529 Lisp_Object display; | |
6530 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6531 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6532 |
6533 return make_number (1); | |
6534 } | |
6535 | |
6536 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0, | |
6537 "Returns the height in millimeters of the X display DISPLAY.\n\ | |
6538 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6539 DISPLAY should be either a frame or a display name (a string).\n\ | |
6540 If omitted or nil, that stands for the selected frame's display.") | |
6541 (display) | |
6542 Lisp_Object display; | |
6543 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6544 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6545 HDC hdc; |
6546 int cap; | |
6547 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6548 hdc = GetDC (dpyinfo->root_window); |
14353 | 6549 |
13434 | 6550 cap = GetDeviceCaps (hdc, VERTSIZE); |
14353 | 6551 |
13434 | 6552 ReleaseDC (dpyinfo->root_window, hdc); |
6553 | |
6554 return make_number (cap); | |
6555 } | |
6556 | |
6557 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, | |
6558 "Returns the width in millimeters of the X display DISPLAY.\n\ | |
6559 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6560 DISPLAY should be either a frame or a display name (a string).\n\ | |
6561 If omitted or nil, that stands for the selected frame's display.") | |
6562 (display) | |
6563 Lisp_Object display; | |
6564 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6565 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6566 |
6567 HDC hdc; | |
6568 int cap; | |
6569 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6570 hdc = GetDC (dpyinfo->root_window); |
14353 | 6571 |
13434 | 6572 cap = GetDeviceCaps (hdc, HORZSIZE); |
14353 | 6573 |
13434 | 6574 ReleaseDC (dpyinfo->root_window, hdc); |
6575 | |
6576 return make_number (cap); | |
6577 } | |
6578 | |
6579 DEFUN ("x-display-backing-store", Fx_display_backing_store, | |
6580 Sx_display_backing_store, 0, 1, 0, | |
6581 "Returns an indication of whether display DISPLAY does backing store.\n\ | |
6582 The value may be `always', `when-mapped', or `not-useful'.\n\ | |
6583 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6584 DISPLAY should be either a frame or a display name (a string).\n\ | |
6585 If omitted or nil, that stands for the selected frame's display.") | |
6586 (display) | |
6587 Lisp_Object display; | |
6588 { | |
6589 return intern ("not-useful"); | |
6590 } | |
6591 | |
6592 DEFUN ("x-display-visual-class", Fx_display_visual_class, | |
6593 Sx_display_visual_class, 0, 1, 0, | |
6594 "Returns the visual class of the display DISPLAY.\n\ | |
6595 The value is one of the symbols `static-gray', `gray-scale',\n\ | |
6596 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\ | |
6597 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6598 DISPLAY should be either a frame or a display name (a string).\n\ | |
6599 If omitted or nil, that stands for the selected frame's display.") | |
6600 (display) | |
6601 Lisp_Object display; | |
6602 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6603 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6604 |
6605 #if 0 | |
6606 switch (dpyinfo->visual->class) | |
6607 { | |
6608 case StaticGray: return (intern ("static-gray")); | |
6609 case GrayScale: return (intern ("gray-scale")); | |
6610 case StaticColor: return (intern ("static-color")); | |
6611 case PseudoColor: return (intern ("pseudo-color")); | |
6612 case TrueColor: return (intern ("true-color")); | |
6613 case DirectColor: return (intern ("direct-color")); | |
6614 default: | |
6615 error ("Display has an unknown visual class"); | |
6616 } | |
6617 #endif | |
6618 | |
6619 error ("Display has an unknown visual class"); | |
6620 } | |
6621 | |
6622 DEFUN ("x-display-save-under", Fx_display_save_under, | |
6623 Sx_display_save_under, 0, 1, 0, | |
6624 "Returns t if the display DISPLAY supports the save-under feature.\n\ | |
6625 The optional argument DISPLAY specifies which display to ask about.\n\ | |
6626 DISPLAY should be either a frame or a display name (a string).\n\ | |
6627 If omitted or nil, that stands for the selected frame's display.") | |
6628 (display) | |
6629 Lisp_Object display; | |
6630 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6631 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6632 |
6633 return Qnil; | |
6634 } | |
6635 | |
6636 int | |
6637 x_pixel_width (f) | |
6638 register struct frame *f; | |
6639 { | |
6640 return PIXEL_WIDTH (f); | |
6641 } | |
6642 | |
6643 int | |
6644 x_pixel_height (f) | |
6645 register struct frame *f; | |
6646 { | |
6647 return PIXEL_HEIGHT (f); | |
6648 } | |
6649 | |
6650 int | |
6651 x_char_width (f) | |
6652 register struct frame *f; | |
6653 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6654 return FONT_WIDTH (f->output_data.w32->font); |
13434 | 6655 } |
6656 | |
6657 int | |
6658 x_char_height (f) | |
6659 register struct frame *f; | |
6660 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6661 return f->output_data.w32->line_height; |
13434 | 6662 } |
6663 | |
6664 int | |
6665 x_screen_planes (frame) | |
6666 Lisp_Object frame; | |
6667 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6668 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
|
6669 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits); |
13434 | 6670 } |
6671 | |
6672 /* Return the display structure for the display named NAME. | |
6673 Open a new connection if necessary. */ | |
6674 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6675 struct w32_display_info * |
13434 | 6676 x_display_info_for_name (name) |
6677 Lisp_Object name; | |
6678 { | |
6679 Lisp_Object names; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6680 struct w32_display_info *dpyinfo; |
13434 | 6681 |
6682 CHECK_STRING (name, 0); | |
6683 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6684 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list; |
13434 | 6685 dpyinfo; |
6686 dpyinfo = dpyinfo->next, names = XCONS (names)->cdr) | |
6687 { | |
6688 Lisp_Object tem; | |
6689 tem = Fstring_equal (XCONS (XCONS (names)->car)->car, name); | |
6690 if (!NILP (tem)) | |
6691 return dpyinfo; | |
6692 } | |
6693 | |
6694 /* Use this general default value to start with. */ | |
6695 Vx_resource_name = Vinvocation_name; | |
6696 | |
6697 validate_x_resource_name (); | |
6698 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6699 dpyinfo = w32_term_init (name, (unsigned char *)0, |
13434 | 6700 (char *) XSTRING (Vx_resource_name)->data); |
6701 | |
6702 if (dpyinfo == 0) | |
6703 error ("Cannot connect to server %s", XSTRING (name)->data); | |
6704 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6705 w32_in_use = 1; |
13434 | 6706 XSETFASTINT (Vwindow_system_version, 3); |
6707 | |
6708 return dpyinfo; | |
6709 } | |
6710 | |
6711 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, | |
6712 1, 3, 0, "Open a connection to a server.\n\ | |
6713 DISPLAY is the name of the display to connect to.\n\ | |
6714 Optional second arg XRM-STRING is a string of resources in xrdb format.\n\ | |
6715 If the optional third arg MUST-SUCCEED is non-nil,\n\ | |
6716 terminate Emacs if we can't open the connection.") | |
6717 (display, xrm_string, must_succeed) | |
6718 Lisp_Object display, xrm_string, must_succeed; | |
6719 { | |
6720 unsigned int n_planes; | |
6721 unsigned char *xrm_option; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6722 struct w32_display_info *dpyinfo; |
13434 | 6723 |
6724 CHECK_STRING (display, 0); | |
6725 if (! NILP (xrm_string)) | |
6726 CHECK_STRING (xrm_string, 1); | |
6727 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6728 if (! EQ (Vwindow_system, intern ("w32"))) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6729 error ("Not using Microsoft Windows"); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6730 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6731 /* 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
|
6732 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
|
6733 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6734 Lisp_Object color_file; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6735 struct gcpro gcpro1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6736 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6737 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
|
6738 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6739 GCPRO1 (color_file); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6740 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6741 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
|
6742 color_file = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6743 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
|
6744 Fsymbol_value (intern ("data-directory"))); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6745 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6746 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
|
6747 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6748 UNGCPRO; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6749 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6750 if (NILP (Vw32_color_map)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6751 Vw32_color_map = Fw32_default_color_map (); |
13434 | 6752 |
6753 if (! NILP (xrm_string)) | |
6754 xrm_option = (unsigned char *) XSTRING (xrm_string)->data; | |
6755 else | |
6756 xrm_option = (unsigned char *) 0; | |
6757 | |
6758 /* 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
|
6759 /* 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
|
6760 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6761 char basename[ MAX_PATH ], *str; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6762 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6763 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
|
6764 str = strrchr (basename, '.'); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6765 if (str) *str = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6766 Vinvocation_name = build_string (basename); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6767 } |
13434 | 6768 Vx_resource_name = Vinvocation_name; |
6769 | |
6770 validate_x_resource_name (); | |
6771 | |
6772 /* This is what opens the connection and sets x_current_display. | |
6773 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
|
6774 dpyinfo = w32_term_init (display, xrm_option, |
13434 | 6775 (char *) XSTRING (Vx_resource_name)->data); |
6776 | |
6777 if (dpyinfo == 0) | |
6778 { | |
6779 if (!NILP (must_succeed)) | |
14353 | 6780 fatal ("Cannot connect to server %s.\n", |
6781 XSTRING (display)->data); | |
13434 | 6782 else |
6783 error ("Cannot connect to server %s", XSTRING (display)->data); | |
6784 } | |
6785 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6786 w32_in_use = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6787 |
13434 | 6788 XSETFASTINT (Vwindow_system_version, 3); |
6789 return Qnil; | |
6790 } | |
6791 | |
6792 DEFUN ("x-close-connection", Fx_close_connection, | |
6793 Sx_close_connection, 1, 1, 0, | |
6794 "Close the connection to DISPLAY's server.\n\ | |
6795 For DISPLAY, specify either a frame or a display name (a string).\n\ | |
6796 If DISPLAY is nil, that stands for the selected frame's display.") | |
6797 (display) | |
6798 Lisp_Object display; | |
6799 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6800 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
|
6801 struct w32_display_info *tail; |
13434 | 6802 int i; |
6803 | |
6804 if (dpyinfo->reference_count > 0) | |
6805 error ("Display still has frames on it"); | |
6806 | |
6807 BLOCK_INPUT; | |
6808 /* Free the fonts in the font table. */ | |
6809 for (i = 0; i < dpyinfo->n_fonts; i++) | |
6810 { | |
6811 if (dpyinfo->font_table[i].name) | |
6812 free (dpyinfo->font_table[i].name); | |
6813 /* Don't free the full_name string; | |
6814 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
|
6815 w32_unload_font (dpyinfo, dpyinfo->font_table[i].font); |
13434 | 6816 } |
6817 x_destroy_all_bitmaps (dpyinfo); | |
6818 | |
6819 x_delete_display (dpyinfo); | |
6820 UNBLOCK_INPUT; | |
6821 | |
6822 return Qnil; | |
6823 } | |
6824 | |
6825 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, | |
6826 "Return the list of display names that Emacs has connections to.") | |
6827 () | |
6828 { | |
6829 Lisp_Object tail, result; | |
6830 | |
6831 result = Qnil; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6832 for (tail = w32_display_name_list; ! NILP (tail); tail = XCONS (tail)->cdr) |
13434 | 6833 result = Fcons (XCONS (XCONS (tail)->car)->car, result); |
6834 | |
6835 return result; | |
6836 } | |
6837 | |
6838 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, | |
6839 "If ON is non-nil, report errors as soon as the erring request is made.\n\ | |
6840 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
|
6841 This is a noop on W32 systems.\n\ |
13434 | 6842 The optional second argument DISPLAY specifies which display to act on.\n\ |
6843 DISPLAY should be either a frame or a display name (a string).\n\ | |
6844 If DISPLAY is omitted or nil, that stands for the selected frame's display.") | |
6845 (on, display) | |
6846 Lisp_Object display, on; | |
6847 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6848 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 6849 |
6850 return Qnil; | |
6851 } | |
6852 | |
6853 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6854 /* 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
|
6855 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6856 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
|
6857 "This will display the W32 font dialog and return an X font string corresponding to the selection.") |
13434 | 6858 (frame) |
6859 Lisp_Object frame; | |
6860 { | |
6861 FRAME_PTR f = check_x_frame (frame); | |
6862 CHOOSEFONT cf; | |
6863 LOGFONT lf; | |
6864 char buf[100]; | |
6865 | |
6866 bzero (&cf, sizeof (cf)); | |
6867 | |
6868 cf.lStructSize = sizeof (cf); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6869 cf.hwndOwner = FRAME_W32_WINDOW (f); |
13434 | 6870 cf.Flags = CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_SCREENFONTS; |
6871 cf.lpLogFont = &lf; | |
6872 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6873 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100)) |
14353 | 6874 return Qnil; |
13434 | 6875 |
6876 return build_string (buf); | |
6877 } | |
6878 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6879 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
|
6880 "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
|
6881 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
|
6882 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
|
6883 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
|
6884 screen saver if defined.\n\ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6885 \n\ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6886 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
|
6887 (command, frame) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6888 Lisp_Object command, frame; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6889 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6890 WPARAM code; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6891 FRAME_PTR f = check_x_frame (frame); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6892 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6893 CHECK_NUMBER (command, 0); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6894 |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
6895 SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XINT (command), 0); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6896 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6897 return Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6898 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6899 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6900 /* Lookup virtual keycode from string representing the name of a |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6901 non-ascii keystroke into the corresponding virtual key, using |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6902 lispy_function_keys. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6903 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6904 lookup_vk_code (char *key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6905 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6906 int i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6907 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6908 for (i = 0; i < 256; i++) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6909 if (lispy_function_keys[i] != 0 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6910 && strcmp (lispy_function_keys[i], key) == 0) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6911 return i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6912 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6913 return -1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6914 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6915 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6916 /* Convert a one-element vector style key sequence to a hot key |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6917 definition. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6918 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6919 w32_parse_hot_key (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6920 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6921 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6922 /* Copied from Fdefine_key and store_in_keymap. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6923 register Lisp_Object c; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6924 int vk_code; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6925 int lisp_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6926 int w32_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6927 struct gcpro gcpro1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6928 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6929 CHECK_VECTOR (key, 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6930 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6931 if (XFASTINT (Flength (key)) != 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6932 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6933 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6934 GCPRO1 (key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6935 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6936 c = Faref (key, make_number (0)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6937 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6938 if (CONSP (c) && lucid_event_type_list_p (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6939 c = Fevent_convert_list (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6940 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6941 UNGCPRO; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6942 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6943 if (! INTEGERP (c) && ! SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6944 error ("Key definition is invalid"); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6945 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6946 /* Work out the base key and the modifiers. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6947 if (SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6948 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6949 c = parse_modifiers (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6950 lisp_modifiers = Fcar (Fcdr (c)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6951 c = Fcar (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6952 if (!SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6953 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6954 vk_code = lookup_vk_code (XSYMBOL (c)->name->data); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6955 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6956 else if (INTEGERP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6957 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6958 lisp_modifiers = XINT (c) & ~CHARACTERBITS; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6959 /* Many ascii characters are their own virtual key code. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6960 vk_code = XINT (c) & CHARACTERBITS; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6961 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6962 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6963 if (vk_code < 0 || vk_code > 255) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6964 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6965 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6966 if ((lisp_modifiers & meta_modifier) != 0 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6967 && !NILP (Vw32_alt_is_meta)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6968 lisp_modifiers |= alt_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6969 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6970 /* Convert lisp modifiers to Windows hot-key form. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6971 w32_modifiers = (lisp_modifiers & hyper_modifier) ? MOD_WIN : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6972 w32_modifiers |= (lisp_modifiers & alt_modifier) ? MOD_ALT : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6973 w32_modifiers |= (lisp_modifiers & ctrl_modifier) ? MOD_CONTROL : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6974 w32_modifiers |= (lisp_modifiers & shift_modifier) ? MOD_SHIFT : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6975 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6976 return HOTKEY (vk_code, w32_modifiers); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6977 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6978 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6979 DEFUN ("w32-register-hot-key", Fw32_register_hot_key, Sw32_register_hot_key, 1, 1, 0, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6980 "Register KEY as a hot-key combination.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6981 Certain key combinations like Alt-Tab are reserved for system use on\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6982 Windows, and therefore are normally intercepted by the system. However,\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6983 most of these key combinations can be received by registering them as\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6984 hot-keys, overriding their special meaning.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6985 \n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6986 KEY must be a one element key definition in vector form that would be\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6987 acceptable to `define-key' (e.g. [A-tab] for Alt-Tab). The meta\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6988 modifier is interpreted as Alt if `w32-alt-is-meta' is t, and hyper\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6989 is always interpreted as the Windows modifier keys.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6990 \n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6991 The return value is the hotkey-id if registered, otherwise nil.") |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6992 (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6993 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6994 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6995 key = w32_parse_hot_key (key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6996 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6997 if (NILP (Fmemq (key, w32_grabbed_keys))) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6998 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
6999 /* Reuse an empty slot if possible. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7000 Lisp_Object item = Fmemq (Qnil, w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7001 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7002 /* Safe to add new key to list, even if we have focus. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7003 if (NILP (item)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7004 w32_grabbed_keys = Fcons (key, w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7005 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7006 XCAR (item) = key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7007 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7008 /* Notify input thread about new hot-key definition, so that it |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7009 takes effect without needing to switch focus. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7010 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7011 (WPARAM) key, 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7012 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7013 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7014 return key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7015 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7016 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7017 DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key, Sw32_unregister_hot_key, 1, 1, 0, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7018 "Unregister HOTKEY as a hot-key combination.") |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7019 (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7020 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7021 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7022 Lisp_Object item; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7023 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7024 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7025 key = w32_parse_hot_key (key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7026 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7027 item = Fmemq (key, w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7028 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7029 if (!NILP (item)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7030 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7031 /* Notify input thread about hot-key definition being removed, so |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7032 that it takes effect without needing focus switch. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7033 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7034 (WPARAM) XINT (XCAR (item)), (LPARAM) item)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7035 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7036 MSG msg; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7037 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7038 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7039 return Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7040 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7041 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7042 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7043 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7044 DEFUN ("w32-registered-hot-keys", Fw32_registered_hot_keys, Sw32_registered_hot_keys, 0, 0, 0, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7045 "Return list of registered hot-key IDs.") |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7046 () |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7047 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7048 return Fcopy_sequence (w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7049 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7050 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7051 DEFUN ("w32-reconstruct-hot-key", Fw32_reconstruct_hot_key, Sw32_reconstruct_hot_key, 1, 1, 0, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7052 "Convert hot-key ID to a lisp key combination.") |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7053 (hotkeyid) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7054 Lisp_Object hotkeyid; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7055 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7056 int vk_code, w32_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7057 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7058 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7059 CHECK_NUMBER (hotkeyid, 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7060 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7061 vk_code = HOTKEY_VK_CODE (hotkeyid); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7062 w32_modifiers = HOTKEY_MODIFIERS (hotkeyid); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7063 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7064 if (lispy_function_keys[vk_code]) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7065 key = intern (lispy_function_keys[vk_code]); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7066 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7067 key = make_number (vk_code); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7068 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7069 key = Fcons (key, Qnil); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7070 if (w32_modifiers & MOD_SHIFT) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
7071 key = Fcons (Qshift, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7072 if (w32_modifiers & MOD_CONTROL) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
7073 key = Fcons (Qctrl, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7074 if (w32_modifiers & MOD_ALT) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
7075 key = Fcons (NILP (Vw32_alt_is_meta) ? Qalt : Qmeta, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7076 if (w32_modifiers & MOD_WIN) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
7077 key = Fcons (Qhyper, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7078 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7079 return key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7080 } |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7081 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7082 DEFUN ("w32-toggle-lock-key", Fw32_toggle_lock_key, Sw32_toggle_lock_key, 1, 2, 0, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7083 "Toggle the state of the lock key KEY.\n\ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7084 KEY can be `capslock', `kp-numlock', or `scroll'.\n\ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7085 If the optional parameter NEW-STATE is a number, then the state of KEY\n\ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7086 is set to off if the low bit of NEW-STATE is zero, otherwise on.") |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7087 (key, new_state) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7088 Lisp_Object key, new_state; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7089 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7090 int vk_code; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7091 int cur_state; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7092 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7093 if (EQ (key, intern ("capslock"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7094 vk_code = VK_CAPITAL; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7095 else if (EQ (key, intern ("kp-numlock"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7096 vk_code = VK_NUMLOCK; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7097 else if (EQ (key, intern ("scroll"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7098 vk_code = VK_SCROLL; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7099 else |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7100 return Qnil; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7101 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7102 if (!dwWindowsThreadId) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7103 return make_number (w32_console_toggle_lock_key (vk_code, new_state)); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7104 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7105 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7106 (WPARAM) vk_code, (LPARAM) new_state)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7107 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7108 MSG msg; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7109 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7110 return make_number (msg.wParam); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7111 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7112 return Qnil; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7113 } |
13434 | 7114 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7115 syms_of_w32fns () |
13434 | 7116 { |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7117 /* 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
|
7118 w32_in_use = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7119 |
13434 | 7120 /* The section below is built by the lisp expression at the top of the file, |
7121 just above where these variables are declared. */ | |
7122 /*&&& init symbols here &&&*/ | |
7123 Qauto_raise = intern ("auto-raise"); | |
7124 staticpro (&Qauto_raise); | |
7125 Qauto_lower = intern ("auto-lower"); | |
7126 staticpro (&Qauto_lower); | |
7127 Qbackground_color = intern ("background-color"); | |
7128 staticpro (&Qbackground_color); | |
7129 Qbar = intern ("bar"); | |
7130 staticpro (&Qbar); | |
7131 Qborder_color = intern ("border-color"); | |
7132 staticpro (&Qborder_color); | |
7133 Qborder_width = intern ("border-width"); | |
7134 staticpro (&Qborder_width); | |
7135 Qbox = intern ("box"); | |
7136 staticpro (&Qbox); | |
7137 Qcursor_color = intern ("cursor-color"); | |
7138 staticpro (&Qcursor_color); | |
7139 Qcursor_type = intern ("cursor-type"); | |
7140 staticpro (&Qcursor_type); | |
7141 Qforeground_color = intern ("foreground-color"); | |
7142 staticpro (&Qforeground_color); | |
7143 Qgeometry = intern ("geometry"); | |
7144 staticpro (&Qgeometry); | |
7145 Qicon_left = intern ("icon-left"); | |
7146 staticpro (&Qicon_left); | |
7147 Qicon_top = intern ("icon-top"); | |
7148 staticpro (&Qicon_top); | |
7149 Qicon_type = intern ("icon-type"); | |
7150 staticpro (&Qicon_type); | |
7151 Qicon_name = intern ("icon-name"); | |
7152 staticpro (&Qicon_name); | |
7153 Qinternal_border_width = intern ("internal-border-width"); | |
7154 staticpro (&Qinternal_border_width); | |
7155 Qleft = intern ("left"); | |
7156 staticpro (&Qleft); | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
7157 Qright = intern ("right"); |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
7158 staticpro (&Qright); |
13434 | 7159 Qmouse_color = intern ("mouse-color"); |
7160 staticpro (&Qmouse_color); | |
7161 Qnone = intern ("none"); | |
7162 staticpro (&Qnone); | |
7163 Qparent_id = intern ("parent-id"); | |
7164 staticpro (&Qparent_id); | |
7165 Qscroll_bar_width = intern ("scroll-bar-width"); | |
7166 staticpro (&Qscroll_bar_width); | |
7167 Qsuppress_icon = intern ("suppress-icon"); | |
7168 staticpro (&Qsuppress_icon); | |
7169 Qtop = intern ("top"); | |
7170 staticpro (&Qtop); | |
7171 Qundefined_color = intern ("undefined-color"); | |
7172 staticpro (&Qundefined_color); | |
7173 Qvertical_scroll_bars = intern ("vertical-scroll-bars"); | |
7174 staticpro (&Qvertical_scroll_bars); | |
7175 Qvisibility = intern ("visibility"); | |
7176 staticpro (&Qvisibility); | |
7177 Qwindow_id = intern ("window-id"); | |
7178 staticpro (&Qwindow_id); | |
7179 Qx_frame_parameter = intern ("x-frame-parameter"); | |
7180 staticpro (&Qx_frame_parameter); | |
7181 Qx_resource_name = intern ("x-resource-name"); | |
7182 staticpro (&Qx_resource_name); | |
7183 Quser_position = intern ("user-position"); | |
7184 staticpro (&Quser_position); | |
7185 Quser_size = intern ("user-size"); | |
7186 staticpro (&Quser_size); | |
7187 Qdisplay = intern ("display"); | |
7188 staticpro (&Qdisplay); | |
7189 /* This is the end of symbol initialization. */ | |
7190 | |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7191 Qhyper = intern ("hyper"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7192 staticpro (&Qhyper); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7193 Qsuper = intern ("super"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7194 staticpro (&Qsuper); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7195 Qmeta = intern ("meta"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7196 staticpro (&Qmeta); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7197 Qalt = intern ("alt"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7198 staticpro (&Qalt); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7199 Qctrl = intern ("ctrl"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7200 staticpro (&Qctrl); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7201 Qcontrol = intern ("control"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7202 staticpro (&Qcontrol); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7203 Qshift = intern ("shift"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7204 staticpro (&Qshift); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7205 |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
7206 Qface_set_after_frame_default = intern ("face-set-after-frame-default"); |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
7207 staticpro (&Qface_set_after_frame_default); |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
7208 |
13434 | 7209 Fput (Qundefined_color, Qerror_conditions, |
7210 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | |
7211 Fput (Qundefined_color, Qerror_message, | |
7212 build_string ("Undefined color")); | |
7213 | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7214 staticpro (&w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7215 w32_grabbed_keys = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7216 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7217 DEFVAR_LISP ("w32-color-map", &Vw32_color_map, |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7218 "An 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
|
7219 Vw32_color_map = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7220 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7221 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
|
7222 "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
|
7223 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
|
7224 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
|
7225 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
|
7226 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7227 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
|
7228 "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
|
7229 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
|
7230 Vw32_alt_is_meta = Qt; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7231 |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
7232 DEFVAR_INT ("w32-quit-key", &Vw32_quit_key, |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
7233 "If non-zero, the virtual key code for an alternative quit key."); |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
7234 XSETINT (Vw32_quit_key, 0); |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
7235 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7236 DEFVAR_LISP ("w32-pass-lwindow-to-system", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7237 &Vw32_pass_lwindow_to_system, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7238 "Non-nil if the left \"Windows\" key is passed on to Windows.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7239 When non-nil, the Start menu is opened by tapping the key."); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7240 Vw32_pass_lwindow_to_system = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7241 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7242 DEFVAR_LISP ("w32-pass-rwindow-to-system", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7243 &Vw32_pass_rwindow_to_system, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7244 "Non-nil if the right \"Windows\" key is passed on to Windows.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7245 When non-nil, the Start menu is opened by tapping the key."); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7246 Vw32_pass_rwindow_to_system = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7247 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7248 DEFVAR_INT ("w32-phantom-key-code", |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7249 &Vw32_phantom_key_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7250 "Virtual key code used to generate \"phantom\" key presses.\n\ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7251 Value is a number between 0 and 255.\n\ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7252 \n\ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7253 Phantom key presses are generated in order to stop the system from\n\ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7254 acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or\n\ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7255 `w32-pass-rwindow-to-system' is nil."); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7256 Vw32_phantom_key_code = VK_SPACE; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7257 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7258 DEFVAR_LISP ("w32-enable-num-lock", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7259 &Vw32_enable_num_lock, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7260 "Non-nil if Num Lock should act normally.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7261 Set to nil to see Num Lock as the key `kp-numlock'."); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7262 Vw32_enable_num_lock = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7263 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7264 DEFVAR_LISP ("w32-enable-caps-lock", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7265 &Vw32_enable_caps_lock, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7266 "Non-nil if Caps Lock should act normally.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7267 Set to nil to see Caps Lock as the key `capslock'."); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7268 Vw32_enable_caps_lock = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7269 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7270 DEFVAR_LISP ("w32-scroll-lock-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7271 &Vw32_scroll_lock_modifier, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7272 "Modifier to use for the Scroll Lock on state.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7273 The value can be hyper, super, meta, alt, control or shift for the\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7274 respective modifier, or nil to see Scroll Lock as the key `scroll'.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7275 Any other value will cause the key to be ignored."); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7276 Vw32_scroll_lock_modifier = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7277 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7278 DEFVAR_LISP ("w32-lwindow-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7279 &Vw32_lwindow_modifier, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7280 "Modifier to use for the left \"Windows\" key.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7281 The value can be hyper, super, meta, alt, control or shift for the\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7282 respective modifier, or nil to appear as the key `lwindow'.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7283 Any other value will cause the key to be ignored."); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7284 Vw32_lwindow_modifier = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7285 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7286 DEFVAR_LISP ("w32-rwindow-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7287 &Vw32_rwindow_modifier, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7288 "Modifier to use for the right \"Windows\" key.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7289 The value can be hyper, super, meta, alt, control or shift for the\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7290 respective modifier, or nil to appear as the key `rwindow'.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7291 Any other value will cause the key to be ignored."); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7292 Vw32_rwindow_modifier = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7293 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7294 DEFVAR_LISP ("w32-apps-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7295 &Vw32_apps_modifier, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7296 "Modifier to use for the \"Apps\" key.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7297 The value can be hyper, super, meta, alt, control or shift for the\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7298 respective modifier, or nil to appear as the key `apps'.\n\ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7299 Any other value will cause the key to be ignored."); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7300 Vw32_apps_modifier = Qnil; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7301 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7302 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
|
7303 "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
|
7304 Vw32_enable_italics = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7305 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7306 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
|
7307 "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
|
7308 Vw32_enable_palette = Qt; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7309 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7310 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
|
7311 &Vw32_mouse_button_tolerance, |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7312 "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
|
7313 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
|
7314 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
|
7315 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
|
7316 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
|
7317 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
|
7318 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7319 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
|
7320 &Vw32_mouse_move_interval, |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
7321 "Minimum interval between mouse move events.\n\ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
7322 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
|
7323 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
|
7324 reported as lisp events."); |
24252
e0ae6525db58
(syms_of_w32fns): Change default value of w32-mouse-move-interval to
Andrew Innes <andrewi@gnu.org>
parents:
24214
diff
changeset
|
7325 XSETINT (Vw32_mouse_move_interval, 0); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
7326 |
13434 | 7327 init_x_parm_symbols (); |
7328 | |
7329 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
|
7330 "List of directories to search for bitmap files for w32."); |
13434 | 7331 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH"); |
7332 | |
7333 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape, | |
7334 "The shape of the pointer when over text.\n\ | |
7335 Changing the value does not affect existing frames\n\ | |
7336 unless you set the mouse color."); | |
7337 Vx_pointer_shape = Qnil; | |
7338 | |
7339 DEFVAR_LISP ("x-resource-name", &Vx_resource_name, | |
7340 "The name Emacs uses to look up resources; for internal use only.\n\ | |
7341 `x-get-resource' uses this as the first component of the instance name\n\ | |
7342 when requesting resource values.\n\ | |
7343 Emacs initially sets `x-resource-name' to the name under which Emacs\n\ | |
7344 was invoked, or to the value specified with the `-name' or `-rn'\n\ | |
7345 switches, if present."); | |
7346 Vx_resource_name = Qnil; | |
7347 | |
7348 Vx_nontext_pointer_shape = Qnil; | |
7349 | |
7350 Vx_mode_pointer_shape = Qnil; | |
7351 | |
7352 DEFVAR_INT ("x-sensitive-text-pointer-shape", | |
7353 &Vx_sensitive_text_pointer_shape, | |
7354 "The shape of the pointer when over mouse-sensitive text.\n\ | |
7355 This variable takes effect when you create a new frame\n\ | |
7356 or when you set the mouse color."); | |
7357 Vx_sensitive_text_pointer_shape = Qnil; | |
7358 | |
7359 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, | |
7360 "A string indicating the foreground color of the cursor box."); | |
7361 Vx_cursor_fore_pixel = Qnil; | |
7362 | |
7363 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, | |
7364 "Non-nil if no window manager is in use.\n\ | |
7365 Emacs doesn't try to figure this out; this is always nil\n\ | |
7366 unless you set it to something else."); | |
7367 /* We don't have any way to find this out, so set it to nil | |
7368 and maybe the user would like to set it to t. */ | |
7369 Vx_no_window_manager = Qnil; | |
7370 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7371 DEFVAR_LISP ("x-pixel-size-width-font-regexp", |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7372 &Vx_pixel_size_width_font_regexp, |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7373 "Regexp matching a font name whose width is the same as `PIXEL_SIZE'.\n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7374 \n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7375 Since Emacs gets width of a font matching with this regexp from\n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7376 PIXEL_SIZE field of the name, font finding mechanism gets faster for\n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7377 such a font. This is especially effective for such large fonts as\n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7378 Chinese, Japanese, and Korean."); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7379 Vx_pixel_size_width_font_regexp = Qnil; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7380 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7381 DEFVAR_BOOL ("unibyte-display-via-language-environment", |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7382 &unibyte_display_via_language_environment, |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7383 "*Non-nil means display unibyte text according to language environment.\n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7384 Specifically this means that unibyte non-ASCII characters\n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7385 are displayed by converting them to the equivalent multibyte characters\n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7386 according to the current language environment. As a result, they are\n\ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7387 displayed according to the current fontset."); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7388 unibyte_display_via_language_environment = 0; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7389 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7390 DEFVAR_LISP ("w32-bdf-filename-alist", |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7391 &Vw32_bdf_filename_alist, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7392 "List of bdf fonts and their corresponding filenames."); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7393 Vw32_bdf_filename_alist = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7394 |
13434 | 7395 defsubr (&Sx_get_resource); |
7396 defsubr (&Sx_list_fonts); | |
7397 defsubr (&Sx_display_color_p); | |
7398 defsubr (&Sx_display_grayscale_p); | |
7399 defsubr (&Sx_color_defined_p); | |
7400 defsubr (&Sx_color_values); | |
7401 defsubr (&Sx_server_max_request_size); | |
7402 defsubr (&Sx_server_vendor); | |
7403 defsubr (&Sx_server_version); | |
7404 defsubr (&Sx_display_pixel_width); | |
7405 defsubr (&Sx_display_pixel_height); | |
7406 defsubr (&Sx_display_mm_width); | |
7407 defsubr (&Sx_display_mm_height); | |
7408 defsubr (&Sx_display_screens); | |
7409 defsubr (&Sx_display_planes); | |
7410 defsubr (&Sx_display_color_cells); | |
7411 defsubr (&Sx_display_visual_class); | |
7412 defsubr (&Sx_display_backing_store); | |
7413 defsubr (&Sx_display_save_under); | |
7414 defsubr (&Sx_parse_geometry); | |
7415 defsubr (&Sx_create_frame); | |
7416 defsubr (&Sx_open_connection); | |
7417 defsubr (&Sx_close_connection); | |
7418 defsubr (&Sx_display_list); | |
7419 defsubr (&Sx_synchronize); | |
7420 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7421 /* W32 specific functions */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7422 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7423 defsubr (&Sw32_focus_frame); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7424 defsubr (&Sw32_select_font); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7425 defsubr (&Sw32_define_rgb_color); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7426 defsubr (&Sw32_default_color_map); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7427 defsubr (&Sw32_load_color_file); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7428 defsubr (&Sw32_send_sys_command); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7429 defsubr (&Sw32_register_hot_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7430 defsubr (&Sw32_unregister_hot_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7431 defsubr (&Sw32_registered_hot_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
7432 defsubr (&Sw32_reconstruct_hot_key); |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
7433 defsubr (&Sw32_toggle_lock_key); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7434 defsubr (&Sw32_find_bdf_fonts); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7435 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7436 /* Setting callback functions for fontset handler. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7437 get_font_info_func = w32_get_font_info; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7438 list_fonts_func = w32_list_fonts; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7439 load_font_func = w32_load_font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7440 find_ccl_program_func = w32_find_ccl_program; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7441 query_font_func = w32_query_font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7442 set_frame_fontset_func = x_set_font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7443 check_window_system_func = check_w32; |
13434 | 7444 } |
7445 | |
7446 #undef abort | |
7447 | |
7448 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7449 w32_abort() |
13434 | 7450 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7451 int button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7452 button = MessageBox (NULL, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7453 "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
|
7454 "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
|
7455 "Emacs Abort Dialog", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7456 MB_ICONEXCLAMATION | MB_TASKMODAL |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7457 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7458 switch (button) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7459 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7460 case IDRETRY: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7461 DebugBreak (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7462 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7463 case IDIGNORE: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7464 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7465 case IDABORT: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7466 default: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7467 abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7468 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7469 } |
13434 | 7470 } |
15148
220145cf7546
(continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents:
15147
diff
changeset
|
7471 |
23801
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
7472 /* For convenience when debugging. */ |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
7473 int |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
7474 w32_last_error() |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
7475 { |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
7476 return GetLastError (); |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
7477 } |