annotate src/w32fns.c @ 23637:54b22e0a1f7b

(w32_list_fonts): Report an error if a frame has not been created yet.
author Geoff Voelker <voelker@cs.washington.edu>
date Wed, 04 Nov 1998 23:38:19 +0000
parents 2b55b8f8cdc1
children af0276da2059
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4 This file is part of GNU Emacs.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 any later version.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 /* Added by Kevin Gallo */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #include "frame.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 #include "window.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #include "buffer.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #include "dispextern.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 #include "keyboard.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39 #include "blockinput.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40 #include "paths.h"
16593
4ed80eda6fac Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
41 #include "w32heap.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 #include <commdlg.h>
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
46 #include <shellapi.h>
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 extern void abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 extern void free_frame_menubar ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 extern struct scroll_bar *x_window_to_scroll_bar ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
51 extern int quit_char;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 /* 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
54 Lisp_Object Vw32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
55
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
56 /* 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
57 Lisp_Object Vw32_pass_alt_to_system;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
58
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
59 /* 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
60 to alt_modifier. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
61 Lisp_Object Vw32_alt_is_meta;
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
62
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
63 /* Non nil if left window, right window, and application key events
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
64 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
65 Lisp_Object Vw32_pass_optional_keys_to_system;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
66
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
67 /* 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
68 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
69 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
70
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
71 /* Enable palette management. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
72 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
73
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
74 /* 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
75 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
76 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
77
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
78 /* 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
79 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
80 Lisp_Object Vw32_mouse_move_interval;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
81
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 /* The name we're using in resource queries. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83 Lisp_Object Vx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85 /* Non nil if no window manager is in use. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86 Lisp_Object Vx_no_window_manager;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 /* The background and shape of the mouse pointer, and shape when not
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89 over text or in the modeline. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91 /* The shape when over mouse-sensitive text. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92 Lisp_Object Vx_sensitive_text_pointer_shape;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
94 /* Color of chars displayed in cursor box. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 Lisp_Object Vx_cursor_fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
96
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
97 /* Nonzero if using Windows. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
98 static int w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
99
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100 /* Search path for bitmap files. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 Lisp_Object Vx_bitmap_file_path;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
103 /* 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
104 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
105
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
106 /* 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
107 int unibyte_display_via_language_environment;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
108
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109 /* Evaluate this expression to rebuild the section of syms_of_w32fns
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110 that initializes and staticpros the symbols declared below. Note
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 that Emacs 18 has a bug that keeps C-x C-e from being able to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 evaluate this expression.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
114 (progn
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
115 ;; Accumulate a list of the symbols we want to initialize from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 ;; declarations at the top of the file.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117 (goto-char (point-min))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118 (search-forward "/\*&&& symbols declared here &&&*\/\n")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119 (let (symbol-list)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 (setq symbol-list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
122 (cons (buffer-substring (match-beginning 1) (match-end 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123 symbol-list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124 (forward-line 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
125 (setq symbol-list (nreverse symbol-list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126 ;; Delete the section of syms_of_... where we initialize the symbols.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
127 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 (let ((start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129 (while (looking-at "^ Q")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130 (forward-line 2))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131 (kill-region start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132 ;; Write a new symbol initialization section.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
133 (while symbol-list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
134 (insert (format " %s = intern (\"" (car symbol-list)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
135 (let ((start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 (insert (substring (car symbol-list) 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137 (subst-char-in-region start (point) ?_ ?-))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139 (setq symbol-list (cdr symbol-list)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143 /*&&& symbols declared here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
144 Lisp_Object Qauto_raise;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
145 Lisp_Object Qauto_lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 Lisp_Object Qbackground_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 Lisp_Object Qbar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148 Lisp_Object Qborder_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 Lisp_Object Qborder_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 Lisp_Object Qbox;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 Lisp_Object Qcursor_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
152 Lisp_Object Qcursor_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 Lisp_Object Qforeground_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 Lisp_Object Qgeometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 Lisp_Object Qicon_left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 Lisp_Object Qicon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 Lisp_Object Qicon_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 Lisp_Object Qicon_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 Lisp_Object Qinternal_border_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 Lisp_Object Qleft;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
161 Lisp_Object Qright;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162 Lisp_Object Qmouse_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 Lisp_Object Qnone;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 Lisp_Object Qparent_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 Lisp_Object Qscroll_bar_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 Lisp_Object Qsuppress_icon;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 Lisp_Object Qtop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
168 Lisp_Object Qundefined_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 Lisp_Object Qvertical_scroll_bars;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 Lisp_Object Qvisibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 Lisp_Object Qwindow_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
172 Lisp_Object Qx_frame_parameter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 Lisp_Object Qx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174 Lisp_Object Quser_position;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
175 Lisp_Object Quser_size;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
176 Lisp_Object Qdisplay;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
178 /* 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
179 #define LMOUSE 1
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
180 #define MMOUSE 2
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
181 #define RMOUSE 4
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
182
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
183 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
184 static W32Msg saved_mouse_button_msg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
185 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
186 static W32Msg saved_mouse_move_msg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
187 static unsigned mouse_move_timer;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
188
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
189 /* W95 mousewheel handler */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
190 unsigned int msh_mousewheel = 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
191
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
192 #define MOUSE_BUTTON_ID 1
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
193 #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
194
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195 /* The below are defined in frame.c. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
196 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
197 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
198
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199 extern Lisp_Object Vwindow_system_version;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
201 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
202
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
203 extern Lisp_Object last_mouse_scroll_bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204 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
205
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
206 /* From w32term.c. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
207 extern Lisp_Object Vw32_num_mouse_buttons;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
208
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
210 /* 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
211 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
212 check_w32 ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
213 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
214 if (! w32_in_use)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
215 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
216 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
217
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
218 /* Nonzero if we can use mouse menus.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
219 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
220
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
221 int
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
222 have_menus_p ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
223 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
224 return w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
225 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
226
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227 /* 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
228 and checking validity for W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
229
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
230 FRAME_PTR
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
231 check_x_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
232 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
233 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
234 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
235
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
237 f = selected_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
238 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
239 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
240 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
241 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
242 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
243 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
244 error ("non-w32 frame used");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
245 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
246 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
247
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
248 /* 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
249 nil stands for the selected frame--or, if that is not a w32 frame,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
250 the first display on the list. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
252 static struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
253 check_x_display_info (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
254 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
255 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
258 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
259 return FRAME_W32_DISPLAY_INFO (selected_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
261 return &one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
262 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
263 else if (STRINGP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
264 return x_display_info_for_name (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
265 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
266 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
267 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
268
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
270 f = XFRAME (frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
271 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
272 error ("non-w32 frame used");
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
273 return FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
275 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
276
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
277 /* Return the Emacs frame-object corresponding to an w32 window.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
278 It could be the frame's main window or an icon window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
279
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
280 /* This function can be called during GC, so use GC_xxx type test macros. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282 struct frame *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283 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
284 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
285 HWND wdesc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287 Lisp_Object tail, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
288 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
289
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
290 for (tail = Vframe_list; GC_CONSP (tail); tail = XCONS (tail)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292 frame = XCONS (tail)->car;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293 if (!GC_FRAMEP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296 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
297 || FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298 continue;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
299 if (FRAME_W32_WINDOW (f) == wdesc)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
300 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
301 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
302 return 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
303 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
304
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
305
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
306
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
308 id, which is just an int that this section returns. Bitmaps are
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309 reference counted so they can be shared among frames.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311 Bitmap indices are guaranteed to be > 0, so a negative number can
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
312 be used to indicate no bitmap.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 If you use x_create_bitmap_from_data, then you must keep track of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315 the bitmaps yourself. That is, creating a bitmap from the same
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 data more than once will not be caught. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
317
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
318
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319 /* Functions to access the contents of a bitmap, given an id. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
320
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
321 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322 x_bitmap_height (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
326 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
327 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330 x_bitmap_width (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
334 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 x_bitmap_pixmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
341 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
342 return (int) FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
345
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 /* Allocate a new bitmap record. Returns index of new record. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 x_allocate_bitmap_record (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
352 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 if (dpyinfo->bitmaps == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 dpyinfo->bitmaps_size = 10;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 dpyinfo->bitmaps
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
359 = (struct w32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360 dpyinfo->bitmaps_last = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361 return 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
364 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 return ++dpyinfo->bitmaps_last;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 for (i = 0; i < dpyinfo->bitmaps_size; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368 if (dpyinfo->bitmaps[i].refcount == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 return i + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371 dpyinfo->bitmaps_size *= 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372 dpyinfo->bitmaps
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
373 = (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
374 dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 return ++dpyinfo->bitmaps_last;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 /* Add one reference to the reference count of the bitmap with id ID. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 x_reference_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
385 ++FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
387
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391 x_create_bitmap_from_data (f, bits, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 char *bits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
396 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 bitmap = CreateBitmap (width, height,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
401 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
402 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 bits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 if (! bitmap)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
408 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
409 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 dpyinfo->bitmaps[id - 1].hinst = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
416
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
417 return id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
420 /* Create bitmap from file FILE for frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
421
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423 x_create_bitmap_from_file (f, file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 Lisp_Object file;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
429 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
431 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
432 int xhot, yhot, result, id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 Lisp_Object found;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 int fd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 char *filename;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 /* Look for an existing bitmap with the same name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439 for (id = 0; id < dpyinfo->bitmaps_last; ++id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
441 if (dpyinfo->bitmaps[id].refcount
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
442 && dpyinfo->bitmaps[id].file
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445 ++dpyinfo->bitmaps[id].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
446 return id + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450 /* Search bitmap-file-path for the file, if appropriate. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 fd = openp (Vx_bitmap_file_path, file, "", &found, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 if (fd < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453 return -1;
23407
4587be644789 (x_create_bitmap_from_file): Skip special files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23314
diff changeset
454 /* 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
455 if (fd == 0)
4587be644789 (x_create_bitmap_from_file): Skip special files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23314
diff changeset
456 return -1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457 close (fd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459 filename = (char *) XSTRING (found)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
460
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
462
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
463 if (hinst == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
464 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
467 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468 filename, &width, &height, &bitmap, &xhot, &yhot);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469 if (result != BitmapSuccess)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
471
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
472 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
473 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
474 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
476 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
477 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
480
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
481 return id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
483 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
484
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485 /* Remove reference to bitmap with id number ID. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
486
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
487 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
488 x_destroy_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
489 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
490 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
491 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
492 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
493
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
494 if (id > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
495 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
496 --dpyinfo->bitmaps[id - 1].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497 if (dpyinfo->bitmaps[id - 1].refcount == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
498 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
499 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
500 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
501 if (dpyinfo->bitmaps[id - 1].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
502 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
503 free (dpyinfo->bitmaps[id - 1].file);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
504 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
505 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
506 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
507 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
508 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
509 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
510
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
511 /* Free all the bitmaps for the display specified by DPYINFO. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
512
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
513 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
514 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
515 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
516 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
517 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
518 for (i = 0; i < dpyinfo->bitmaps_last; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
519 if (dpyinfo->bitmaps[i].refcount > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
520 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
521 DeleteObject (dpyinfo->bitmaps[i].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
522 if (dpyinfo->bitmaps[i].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
523 free (dpyinfo->bitmaps[i].file);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
524 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
525 dpyinfo->bitmaps_last = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
526 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
527
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
528 /* Connect the frame-parameter names for W32 frames
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
529 to the ways of passing the parameter values to the window system.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
530
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
531 The name of a parameter, as a Lisp symbol,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
532 has an `x-frame-parameter' property which is an integer in Lisp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
533 but can be interpreted as an `enum x_frame_parm' in C. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
534
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
535 enum x_frame_parm
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
536 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
537 X_PARM_FOREGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
538 X_PARM_BACKGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
539 X_PARM_MOUSE_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
540 X_PARM_CURSOR_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
541 X_PARM_BORDER_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
542 X_PARM_ICON_TYPE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
543 X_PARM_FONT,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
544 X_PARM_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
545 X_PARM_INTERNAL_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
546 X_PARM_NAME,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
547 X_PARM_AUTORAISE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
548 X_PARM_AUTOLOWER,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549 X_PARM_VERT_SCROLL_BAR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550 X_PARM_VISIBILITY,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
551 X_PARM_MENU_BAR_LINES
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
552 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
553
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
554
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
555 struct x_frame_parm_table
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
556 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
557 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
558 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ );
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
559 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
560
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
561 void x_set_foreground_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
562 void x_set_background_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
563 void x_set_mouse_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
564 void x_set_cursor_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
565 void x_set_border_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
566 void x_set_cursor_type ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
567 void x_set_icon_type ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568 void x_set_icon_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
569 void x_set_font ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 void x_set_border_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571 void x_set_internal_border_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 void x_explicitly_set_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
573 void x_set_autoraise ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
574 void x_set_autolower ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
575 void x_set_vertical_scroll_bars ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
576 void x_set_visibility ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
577 void x_set_menu_bar_lines ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
578 void x_set_scroll_bar_width ();
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
579 void x_set_title ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
580 void x_set_unsplittable ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
581
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
582 static struct x_frame_parm_table x_frame_parms[] =
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
583 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
584 "auto-raise", x_set_autoraise,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
585 "auto-lower", x_set_autolower,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
586 "background-color", x_set_background_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
587 "border-color", x_set_border_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
588 "border-width", x_set_border_width,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
589 "cursor-color", x_set_cursor_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
590 "cursor-type", x_set_cursor_type,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
591 "font", x_set_font,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
592 "foreground-color", x_set_foreground_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
593 "icon-name", x_set_icon_name,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
594 "icon-type", x_set_icon_type,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
595 "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
596 "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
597 "mouse-color", x_set_mouse_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
598 "name", x_explicitly_set_name,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
599 "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
600 "title", x_set_title,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
601 "unsplittable", x_set_unsplittable,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
602 "vertical-scroll-bars", x_set_vertical_scroll_bars,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
603 "visibility", x_set_visibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
604 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
605
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
606 /* 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
607 the Lisp symbol names of parameters relevant to W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
608
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
609 init_x_parm_symbols ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
610 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
611 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
614 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
615 make_number (i));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
616 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
617
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
618 /* Change the parameters of FRAME as specified by ALIST.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
619 If a parameter is not specially recognized, do nothing;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
620 otherwise call the `x_set_...' function for that parameter. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
621
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
622 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
623 x_set_frame_parameters (f, alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
624 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
625 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
626 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
627 Lisp_Object tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
628
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
629 /* If both of these parameters are present, it's more efficient to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
630 set them both at once. So we wait until we've looked at the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
631 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
632 int width, height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
633
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
634 /* Same here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
635 Lisp_Object left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
636
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
637 /* Same with these. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
638 Lisp_Object icon_left, icon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
639
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
640 /* Record in these vectors all the parms specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
641 Lisp_Object *parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
642 Lisp_Object *values;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
643 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
644 int left_no_change = 0, top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
645 int icon_left_no_change = 0, icon_top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
646
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
647 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
648 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
649 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
650
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
651 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
652 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
653
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
654 /* Extract parm names and values into those vectors. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
655
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
656 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
657 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
658 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
659 Lisp_Object elt, prop, val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
660
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
661 elt = Fcar (tail);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
662 parms[i] = Fcar (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
663 values[i] = Fcdr (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
664 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
665 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
666
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
667 top = left = Qunbound;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
668 icon_left = icon_top = Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
669
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
670 /* 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
671 width = FRAME_WIDTH (f);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
672 height = FRAME_HEIGHT (f);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
673
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
674 /* Now process them in reverse of specified order. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
675 for (i--; i >= 0; i--)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
676 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
677 Lisp_Object prop, val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
678
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
679 prop = parms[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
680 val = values[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
681
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
682 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
683 width = XFASTINT (val);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
684 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
685 height = XFASTINT (val);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
686 else if (EQ (prop, Qtop))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
687 top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
688 else if (EQ (prop, Qleft))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
689 left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
690 else if (EQ (prop, Qicon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
691 icon_top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
692 else if (EQ (prop, Qicon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
693 icon_left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
694 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
695 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
696 register Lisp_Object param_index, old_value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
697
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
698 param_index = Fget (prop, Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
699 old_value = get_frame_param (f, prop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
700 store_frame_param (f, prop, val);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
701 if (NATNUMP (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
702 && (XFASTINT (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
703 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
704 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
705 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
706 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
707
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
708 /* Don't die if just one of these was set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
709 if (EQ (left, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
710 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
711 left_no_change = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
712 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
713 left = Fcons (Qplus, Fcons (make_number (f->output_data.w32->left_pos), Qnil));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
714 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
715 XSETINT (left, f->output_data.w32->left_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
716 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
717 if (EQ (top, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
718 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
719 top_no_change = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
720 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
721 top = Fcons (Qplus, Fcons (make_number (f->output_data.w32->top_pos), Qnil));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
722 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
723 XSETINT (top, f->output_data.w32->top_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
724 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
725
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
726 /* If one of the icon positions was not set, preserve or default it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
727 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
728 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
729 icon_left_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
730 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
731 if (NILP (icon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
732 XSETINT (icon_left, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
733 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
734 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
735 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
736 icon_top_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
737 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
738 if (NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
739 XSETINT (icon_top, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
740 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
741
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
742 /* Don't set these parameters unless they've been explicitly
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
743 specified. The window might be mapped or resized while we're in
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
744 this function, and we don't want to override that unless the lisp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
745 code has asked for it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
746
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
747 Don't set these parameters unless they actually differ from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
748 window's current parameters; the window may not actually exist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
749 yet. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
750 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
751 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
752
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
753 check_frame_size (f, &height, &width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
754
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
755 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
756
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
757 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
758 || 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
759 Fset_frame_size (frame, make_number (width), make_number (height));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
760
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
761 if ((!NILP (left) || !NILP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
762 && ! (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
763 && ! (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
764 && NUMBERP (top) && XINT (top) == f->output_data.w32->top_pos))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
765 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
766 int leftpos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
767 int toppos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
768
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
769 /* Record the signs. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
770 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
771 if (EQ (left, Qminus))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
772 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
773 else if (INTEGERP (left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
774 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
775 leftpos = XINT (left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
776 if (leftpos < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
777 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
778 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
779 else if (CONSP (left) && EQ (XCONS (left)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
780 && CONSP (XCONS (left)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
781 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
782 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
783 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
784 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
785 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
786 else if (CONSP (left) && EQ (XCONS (left)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
787 && CONSP (XCONS (left)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
788 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
789 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
790 leftpos = XINT (XCONS (XCONS (left)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
791 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
792
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
793 if (EQ (top, Qminus))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
794 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
795 else if (INTEGERP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
796 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
797 toppos = XINT (top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
798 if (toppos < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
799 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
800 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
801 else if (CONSP (top) && EQ (XCONS (top)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
802 && CONSP (XCONS (top)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
803 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
804 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
805 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
806 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
807 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
808 else if (CONSP (top) && EQ (XCONS (top)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
809 && CONSP (XCONS (top)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
810 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
811 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
812 toppos = XINT (XCONS (XCONS (top)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
813 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
814
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
815
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
816 /* 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
817 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
818 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
819
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
820 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
821
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
822 /* Actually set that position, and convert to absolute. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
823 x_set_offset (f, leftpos, toppos, -1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
824 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
825
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
826 if ((!NILP (icon_left) || !NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
827 && ! (icon_left_no_change && icon_top_no_change))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
828 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
829 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
830 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
831
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
832 /* Store the screen positions of frame F into XPTR and YPTR.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
833 These are the positions of the containing window manager window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
834 not Emacs's own window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
835
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
836 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
837 x_real_positions (f, xptr, yptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
838 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
839 int *xptr, *yptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
840 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
841 POINT pt;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
842
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
843 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
844 RECT rect;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
845
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
846 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
847 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
848
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
849 pt.x = rect.left;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
850 pt.y = rect.top;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
851 }
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
852
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
853 ClientToScreen (FRAME_W32_WINDOW(f), &pt);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
854
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
855 *xptr = pt.x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
856 *yptr = pt.y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
857 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
858
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
859 /* Insert a description of internally-recorded parameters of frame X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
860 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
861 Only parameters that are specific to W32
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
862 and whose values are not correctly recorded in the frame's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
863 param_alist need to be considered here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
864
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
865 x_report_frame_params (f, alistptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
866 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
867 Lisp_Object *alistptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
868 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
869 char buf[16];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
870 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
871
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
872 /* Represent negative positions (off the top or left screen edge)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
873 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
874 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
875 if (f->output_data.w32->left_pos >= 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
876 store_in_alist (alistptr, Qleft, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
877 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
878 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
879
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
880 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
881 if (f->output_data.w32->top_pos >= 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
882 store_in_alist (alistptr, Qtop, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
883 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
884 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
885
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
886 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
887 make_number (f->output_data.w32->border_width));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
888 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
889 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
890 sprintf (buf, "%ld", (long) FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
891 store_in_alist (alistptr, Qwindow_id,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
892 build_string (buf));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
893 store_in_alist (alistptr, Qicon_name, f->icon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
894 FRAME_SAMPLE_VISIBILITY (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
895 store_in_alist (alistptr, Qvisibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
896 (FRAME_VISIBLE_P (f) ? Qt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
897 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
898 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
899 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
900 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
901
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
902
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
903 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
904 "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
905 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
906 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
907 (red, green, blue, name)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
908 Lisp_Object red, green, blue, name;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
909 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
910 Lisp_Object rgb;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
911 Lisp_Object oldrgb = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
912 Lisp_Object entry;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
913
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
914 CHECK_NUMBER (red, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
915 CHECK_NUMBER (green, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
916 CHECK_NUMBER (blue, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
917 CHECK_STRING (name, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
918
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
919 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
920
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
921 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
922
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
923 /* 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
924 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
925 if (NILP (entry))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
926 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
927 entry = Fcons (name, rgb);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
928 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
929 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
930 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
931 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
932 oldrgb = Fcdr (entry);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
933 Fsetcdr (entry, rgb);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
934 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
935
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
936 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
937
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
938 return (oldrgb);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
939 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
940
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
941 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
942 "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
943 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
944 \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
945 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
946 R G B name\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
947 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
948 (filename)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
949 Lisp_Object filename;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
950 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
951 FILE *fp;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
952 Lisp_Object cmap = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
953 Lisp_Object abspath;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
954
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
955 CHECK_STRING (filename, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
956 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
957
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
958 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
959 if (fp)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
960 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
961 char buf[512];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
962 int red, green, blue;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
963 int num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
964
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
965 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
966
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
967 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
968 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
969 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
970 char *name = buf + num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
971 num = strlen (name) - 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
972 if (name[num] == '\n')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
973 name[num] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
974 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
975 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
976 cmap);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
977 }
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 fclose (fp);
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 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
982 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
983
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
984 return cmap;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
985 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
986
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
987 /* The default colors for the w32 color map */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
988 typedef struct colormap_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
989 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
990 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
991 COLORREF colorref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
992 } colormap_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
993
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
994 colormap_t w32_color_map[] =
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
995 {
14983
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
996 {"snow" , PALETTERGB (255,250,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
997 {"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
998 {"GhostWhite" , PALETTERGB (248,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
999 {"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
1000 {"WhiteSmoke" , PALETTERGB (245,245,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1001 {"gainsboro" , PALETTERGB (220,220,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1002 {"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
1003 {"FloralWhite" , PALETTERGB (255,250,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1004 {"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
1005 {"OldLace" , PALETTERGB (253,245,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1006 {"linen" , PALETTERGB (250,240,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1007 {"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
1008 {"AntiqueWhite" , PALETTERGB (250,235,215)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1009 {"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
1010 {"PapayaWhip" , PALETTERGB (255,239,213)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1011 {"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
1012 {"BlanchedAlmond" , PALETTERGB (255,235,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1013 {"bisque" , PALETTERGB (255,228,196)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1014 {"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
1015 {"PeachPuff" , PALETTERGB (255,218,185)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1016 {"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
1017 {"NavajoWhite" , PALETTERGB (255,222,173)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1018 {"moccasin" , PALETTERGB (255,228,181)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1019 {"cornsilk" , PALETTERGB (255,248,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1020 {"ivory" , PALETTERGB (255,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1021 {"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
1022 {"LemonChiffon" , PALETTERGB (255,250,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1023 {"seashell" , PALETTERGB (255,245,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1024 {"honeydew" , PALETTERGB (240,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1025 {"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
1026 {"MintCream" , PALETTERGB (245,255,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1027 {"azure" , PALETTERGB (240,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1028 {"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
1029 {"AliceBlue" , PALETTERGB (240,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1030 {"lavender" , PALETTERGB (230,230,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1031 {"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
1032 {"LavenderBlush" , PALETTERGB (255,240,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1033 {"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
1034 {"MistyRose" , PALETTERGB (255,228,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1035 {"white" , PALETTERGB (255,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1036 {"black" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1037 {"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
1038 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1039 {"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
1040 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1041 {"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
1042 {"DimGray" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1043 {"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
1044 {"DimGrey" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1045 {"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
1046 {"SlateGray" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1047 {"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
1048 {"SlateGrey" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1049 {"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
1050 {"LightSlateGray" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1051 {"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
1052 {"LightSlateGrey" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1053 {"gray" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1054 {"grey" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1055 {"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
1056 {"LightGrey" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1057 {"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
1058 {"LightGray" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1059 {"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
1060 {"MidnightBlue" , PALETTERGB ( 25, 25,112)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1061 {"navy" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1062 {"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
1063 {"NavyBlue" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1064 {"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
1065 {"CornflowerBlue" , PALETTERGB (100,149,237)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1066 {"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
1067 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1068 {"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
1069 {"SlateBlue" , PALETTERGB (106, 90,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1070 {"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
1071 {"MediumSlateBlue" , PALETTERGB (123,104,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1072 {"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
1073 {"LightSlateBlue" , PALETTERGB (132,112,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1074 {"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
1075 {"MediumBlue" , PALETTERGB ( 0, 0,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1076 {"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
1077 {"RoyalBlue" , PALETTERGB ( 65,105,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1078 {"blue" , PALETTERGB ( 0, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1079 {"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
1080 {"DodgerBlue" , PALETTERGB ( 30,144,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1081 {"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
1082 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1083 {"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
1084 {"SkyBlue" , PALETTERGB (135,206,235)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1085 {"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
1086 {"LightSkyBlue" , PALETTERGB (135,206,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1087 {"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
1088 {"SteelBlue" , PALETTERGB ( 70,130,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1089 {"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
1090 {"LightSteelBlue" , PALETTERGB (176,196,222)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1091 {"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
1092 {"LightBlue" , PALETTERGB (173,216,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1093 {"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
1094 {"PowderBlue" , PALETTERGB (176,224,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1095 {"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
1096 {"PaleTurquoise" , PALETTERGB (175,238,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1097 {"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
1098 {"DarkTurquoise" , PALETTERGB ( 0,206,209)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1099 {"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
1100 {"MediumTurquoise" , PALETTERGB ( 72,209,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1101 {"turquoise" , PALETTERGB ( 64,224,208)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1102 {"cyan" , PALETTERGB ( 0,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1103 {"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
1104 {"LightCyan" , PALETTERGB (224,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1105 {"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
1106 {"CadetBlue" , PALETTERGB ( 95,158,160)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1107 {"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
1108 {"MediumAquamarine" , PALETTERGB (102,205,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1109 {"aquamarine" , PALETTERGB (127,255,212)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1110 {"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
1111 {"DarkGreen" , PALETTERGB ( 0,100, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1112 {"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
1113 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1114 {"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
1115 {"DarkSeaGreen" , PALETTERGB (143,188,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1116 {"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
1117 {"SeaGreen" , PALETTERGB ( 46,139, 87)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1118 {"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
1119 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1120 {"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
1121 {"LightSeaGreen" , PALETTERGB ( 32,178,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1122 {"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
1123 {"PaleGreen" , PALETTERGB (152,251,152)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1124 {"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
1125 {"SpringGreen" , PALETTERGB ( 0,255,127)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1126 {"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
1127 {"LawnGreen" , PALETTERGB (124,252, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1128 {"green" , PALETTERGB ( 0,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1129 {"chartreuse" , PALETTERGB (127,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1130 {"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
1131 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1132 {"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
1133 {"GreenYellow" , PALETTERGB (173,255, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1134 {"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
1135 {"LimeGreen" , PALETTERGB ( 50,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1136 {"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
1137 {"YellowGreen" , PALETTERGB (154,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1138 {"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
1139 {"ForestGreen" , PALETTERGB ( 34,139, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1140 {"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
1141 {"OliveDrab" , PALETTERGB (107,142, 35)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1142 {"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
1143 {"DarkKhaki" , PALETTERGB (189,183,107)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1144 {"khaki" , PALETTERGB (240,230,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1145 {"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
1146 {"PaleGoldenrod" , PALETTERGB (238,232,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1147 {"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
1148 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1149 {"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
1150 {"LightYellow" , PALETTERGB (255,255,224)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1151 {"yellow" , PALETTERGB (255,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1152 {"gold" , PALETTERGB (255,215, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1153 {"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
1154 {"LightGoldenrod" , PALETTERGB (238,221,130)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1155 {"goldenrod" , PALETTERGB (218,165, 32)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1156 {"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
1157 {"DarkGoldenrod" , PALETTERGB (184,134, 11)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1158 {"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
1159 {"RosyBrown" , PALETTERGB (188,143,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1160 {"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
1161 {"IndianRed" , PALETTERGB (205, 92, 92)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1162 {"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
1163 {"SaddleBrown" , PALETTERGB (139, 69, 19)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1164 {"sienna" , PALETTERGB (160, 82, 45)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1165 {"peru" , PALETTERGB (205,133, 63)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1166 {"burlywood" , PALETTERGB (222,184,135)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1167 {"beige" , PALETTERGB (245,245,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1168 {"wheat" , PALETTERGB (245,222,179)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1169 {"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
1170 {"SandyBrown" , PALETTERGB (244,164, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1171 {"tan" , PALETTERGB (210,180,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1172 {"chocolate" , PALETTERGB (210,105, 30)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1173 {"firebrick" , PALETTERGB (178,34, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1174 {"brown" , PALETTERGB (165,42, 42)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1175 {"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
1176 {"DarkSalmon" , PALETTERGB (233,150,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1177 {"salmon" , PALETTERGB (250,128,114)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1178 {"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
1179 {"LightSalmon" , PALETTERGB (255,160,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1180 {"orange" , PALETTERGB (255,165, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1181 {"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
1182 {"DarkOrange" , PALETTERGB (255,140, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1183 {"coral" , PALETTERGB (255,127, 80)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1184 {"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
1185 {"LightCoral" , PALETTERGB (240,128,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1186 {"tomato" , PALETTERGB (255, 99, 71)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1187 {"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
1188 {"OrangeRed" , PALETTERGB (255, 69, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1189 {"red" , PALETTERGB (255, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1190 {"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
1191 {"HotPink" , PALETTERGB (255,105,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1192 {"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
1193 {"DeepPink" , PALETTERGB (255, 20,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1194 {"pink" , PALETTERGB (255,192,203)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1195 {"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
1196 {"LightPink" , PALETTERGB (255,182,193)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1197 {"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
1198 {"PaleVioletRed" , PALETTERGB (219,112,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1199 {"maroon" , PALETTERGB (176, 48, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1200 {"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
1201 {"MediumVioletRed" , PALETTERGB (199, 21,133)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1202 {"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
1203 {"VioletRed" , PALETTERGB (208, 32,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1204 {"magenta" , PALETTERGB (255, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1205 {"violet" , PALETTERGB (238,130,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1206 {"plum" , PALETTERGB (221,160,221)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1207 {"orchid" , PALETTERGB (218,112,214)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1208 {"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
1209 {"MediumOrchid" , PALETTERGB (186, 85,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1210 {"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
1211 {"DarkOrchid" , PALETTERGB (153, 50,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1212 {"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
1213 {"DarkViolet" , PALETTERGB (148, 0,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1214 {"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
1215 {"BlueViolet" , PALETTERGB (138, 43,226)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1216 {"purple" , PALETTERGB (160, 32,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1217 {"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
1218 {"MediumPurple" , PALETTERGB (147,112,219)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1219 {"thistle" , PALETTERGB (216,191,216)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1220 {"gray0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1221 {"grey0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1222 {"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
1223 {"DarkGrey" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1224 {"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
1225 {"DarkGray" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1226 {"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
1227 {"DarkBlue" , PALETTERGB ( 0, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1228 {"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
1229 {"DarkCyan" , PALETTERGB ( 0,139,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1230 {"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
1231 {"DarkMagenta" , PALETTERGB (139, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1232 {"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
1233 {"DarkRed" , PALETTERGB (139, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1234 {"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
1235 {"LightGreen" , PALETTERGB (144,238,144)},
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1236 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1237
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1238 DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1239 0, 0, 0, "Return the default color map.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1240 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1241 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1242 int i;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1243 colormap_t *pc = w32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1244 Lisp_Object cmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1245
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1246 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1247
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1248 cmap = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1249
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1250 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1251 pc++, i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1252 cmap = Fcons (Fcons (build_string (pc->name),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1253 make_number (pc->colorref)),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1254 cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1255
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1256 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1257
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1258 return (cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1259 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1260
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1261 Lisp_Object
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1262 w32_to_x_color (rgb)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1263 Lisp_Object rgb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1264 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1265 Lisp_Object color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1266
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1267 CHECK_NUMBER (rgb, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1268
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1269 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1270
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1271 color = Frassq (rgb, Vw32_color_map);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1272
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1273 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1274
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1275 if (!NILP (color))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1276 return (Fcar (color));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1277 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1278 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1279 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1280
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1281 COLORREF
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1282 w32_color_map_lookup (colorname)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1283 char *colorname;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1284 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1285 Lisp_Object tail, ret = Qnil;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1286
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1287 BLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1288
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1289 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
1290 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1291 register Lisp_Object elt, tem;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1292
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1293 elt = Fcar (tail);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1294 if (!CONSP (elt)) continue;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1295
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1296 tem = Fcar (elt);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1297
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1298 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1299 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1300 ret = XUINT (Fcdr (elt));
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1301 break;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1302 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1303
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1304 QUIT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1305 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1306
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1307
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1308 UNBLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1309
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1310 return ret;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1311 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1312
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1313 COLORREF
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1314 x_to_w32_color (colorname)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1315 char * colorname;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1316 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1317 register Lisp_Object tail, ret = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1318
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1319 BLOCK_INPUT;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1320
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1321 if (colorname[0] == '#')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1322 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1323 /* 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
1324 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1325 int size;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1326 color = colorname + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1327
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1328 size = strlen(color);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1329 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
1330 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1331 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1332 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1333 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1334 size /= 3;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1335 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1336
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1337 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1338 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1339 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1340 char t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1341 unsigned long value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1342
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1343 /* The check for 'x' in the following conditional takes into
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1344 account the fact that strtol allows a "0x" in front of
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1345 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1346 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1347 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1348 t = color[size];
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1349 color[size] = '\0';
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1350 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1351 color[size] = t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1352 if (errno == ERANGE || end - color != size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1353 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1354 switch (size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1355 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1356 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1357 value = value * 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1358 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1359 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1360 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1361 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1362 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1363 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1364 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1365 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1366 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1367 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1368 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1369 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1370 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1371 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1372 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1373 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1374 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1375 color = end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1376 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1377 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1378 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1379 else if (strnicmp(colorname, "rgb:", 4) == 0)
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 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1382 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1383 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1384 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1385
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1386 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1387 color = colorname + 4;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1388 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1389 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1390 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1391 unsigned long value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1392
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1393 /* 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
1394 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
1395 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1396 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1397 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1398 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1399 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1400 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1401 switch (end - color)
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 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1404 value = value * 0x10 + value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1405 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1406 case 2:
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 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1409 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1410 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1411 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1412 value /= 0x100;
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 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1415 value = ULONG_MAX;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1416 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1417 if (value == ULONG_MAX)
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 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1420 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1421 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1422 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1423 if (*end != '\0')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1424 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1425 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1426 return (colorval);
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 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1429 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1430 color = end + 1;
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 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1433 else if (strnicmp(colorname, "rgbi:", 5) == 0)
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 /* This is an RGB Intensity specification. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1436 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1437 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1438 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1439 pos = 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 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1442 color = colorname + 5;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1443 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1444 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1445 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1446 double value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1447 UINT val;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1448
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1449 value = strtod(color, &end);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1450 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1451 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1452 if (value < 0.0 || value > 1.0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1453 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1454 val = (UINT)(0x100 * value);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1455 /* 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
1456 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
1457 fixes the 1.0 case. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1458 if (val == 0x100)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1459 val = 0xFF;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1460 colorval |= (val << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1461 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1462 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1463 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1464 if (*end != '\0')
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 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1467 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1468 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1469 if (*end != '/')
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 color = end + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1472 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1473 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1474 /* 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
1475 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
1476 RGB. */
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1477
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1478 /* 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
1479 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
1480 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
1481 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
1482 ret = w32_color_map_lookup (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1483 if (NILP (ret))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1484 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1485 int len = strlen (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1486
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1487 if (isdigit (colorname[len - 1]))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1488 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1489 char *ptr, *approx = alloca (len);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1490
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1491 strcpy (approx, colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1492 ptr = &approx[len - 1];
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1493 while (ptr > approx && isdigit (*ptr))
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1494 *ptr-- = '\0';
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1495
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1496 ret = w32_color_map_lookup (approx);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1497 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1498 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1499
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1500 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1501 return ret;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1502 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1503
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1504
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1505 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1506 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
1507 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1508 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
1509 LOGPALETTE * log_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1510 HPALETTE new_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1511 int i;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1512
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1513 /* 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
1514 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
1515 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1516
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1517 log_palette = (LOGPALETTE *)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1518 alloca (sizeof (LOGPALETTE) +
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1519 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
1520 log_palette->palVersion = 0x300;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1521 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
1522
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1523 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
1524 for (i = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1525 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
1526 i++, list = list->next)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1527 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
1528
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1529 new_palette = CreatePalette (log_palette);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1530
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1531 enter_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1532
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1533 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
1534 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
1535 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
1536
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1537 /* 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
1538 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
1539
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1540 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1541 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1542
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1543 #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
1544 #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
1545 do \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1546 { \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1547 pe.peRed = GetRValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1548 pe.peGreen = GetGValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1549 pe.peBlue = GetBValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1550 pe.peFlags = 0; \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1551 } while (0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1552
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1553 #if 0
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1554 /* 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
1555 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1556 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
1557 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1558 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
1559
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1560 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
1561 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1562
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1563 /* 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
1564 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1565 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1566 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
1567 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1568 ++list->refcount;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1569 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1570 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1571 list = list->next;
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
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1574 /* 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
1575 list = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1576 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
1577 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
1578 list->refcount = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1579 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
1580 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
1581 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
1582
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1583 /* 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
1584 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
1585 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1586
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1587 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1588 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
1589 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1590 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
1591 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
1592
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1593 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
1594 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1595
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1596 /* 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
1597 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1598 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1599 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
1600 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1601 if (--list->refcount == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1602 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1603 *prev = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1604 xfree (list);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1605 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
1606 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1607 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1608 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1609 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1610 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1611 prev = &list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1612 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1613 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1614
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1615 /* 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
1616 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
1617 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1618 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1619
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1620 /* Decide if color named COLOR is valid for the display associated with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1621 the selected frame; if so, return the rgb values in COLOR_DEF.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1622 If ALLOC is nonzero, allocate a new colormap cell. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1623
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1624 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1625 defined_color (f, color, color_def, alloc)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1626 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1627 char *color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1628 COLORREF *color_def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1629 int alloc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1630 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1631 register Lisp_Object tem;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1632
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1633 tem = x_to_w32_color (color);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1634
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1635 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1636 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1637 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
1638 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1639 struct w32_palette_entry * entry =
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;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1641 struct w32_palette_entry ** prev =
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1642 &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
1643
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1644 /* 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
1645 while (entry)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1646 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1647 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
1648 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1649 prev = &entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1650 entry = entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1651 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1652
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1653 if (entry == NULL && alloc)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1654 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1655 /* 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
1656 entry = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1657 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
1658 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
1659 entry->next = NULL;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1660 *prev = entry;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1661 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
1662
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1663 /* 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
1664 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
1665 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1666 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1667 /* 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
1668 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
1669 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
1670 *color_def = XUINT (tem) | 0x2000000;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1671 return 1;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1672 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1673 else
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1674 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1675 return 0;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1676 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1677 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1678
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1679 /* Given a string ARG naming a color, compute a pixel value from it
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1680 suitable for screen F.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1681 If F is not a color screen, return DEF (default) regardless of what
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1682 ARG says. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1683
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1684 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1685 x_decode_color (f, arg, def)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1686 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1687 Lisp_Object arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1688 int def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1689 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1690 COLORREF cdef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1691
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1692 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1693
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1694 if (strcmp (XSTRING (arg)->data, "black") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1695 return BLACK_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1696 else if (strcmp (XSTRING (arg)->data, "white") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1697 return WHITE_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1698
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1699 if ((FRAME_W32_DISPLAY_INFO (f)->n_planes * FRAME_W32_DISPLAY_INFO (f)->n_cbits) == 1)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1700 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1701
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1702 /* defined_color is responsible for coping with failures
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1703 by looking for a near-miss. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1704 if (defined_color (f, XSTRING (arg)->data, &cdef, 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1705 return cdef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1706
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1707 /* defined_color failed; return an ultimate default. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1708 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1709 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1710
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1711 /* Functions called only from `x_set_frame_param'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1712 to set individual parameters.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1713
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1714 If FRAME_W32_WINDOW (f) is 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1715 the frame is being created and its window does not exist yet.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1716 In that case, just record the parameter's new value
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1717 in the standard place; do not attempt to change the window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1718
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1719 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1720 x_set_foreground_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1721 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1722 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1723 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1724 f->output_data.w32->foreground_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1725 = 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
1726
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1727 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1728 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1729 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1730 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1731 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1732 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1733 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1734
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1735 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1736 x_set_background_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1737 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1738 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1739 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1740 Pixmap temp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1741 int mask;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1742
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1743 f->output_data.w32->background_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1744 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1745
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1746 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1747 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1748 SetWindowLong (FRAME_W32_WINDOW (f), WND_BACKGROUND_INDEX, f->output_data.w32->background_pixel);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1749
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1750 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1751
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1752 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1753 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1754 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1755 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1756
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1757 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1758 x_set_mouse_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1759 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1760 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1761 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1762 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1763 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
1764 #endif
17632
d2915156a803 (x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents: 16884
diff changeset
1765 int count;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1766 int mask_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1767
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1768 if (!EQ (Qnil, arg))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1769 f->output_data.w32->mouse_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1770 = 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
1771 mask_color = f->output_data.w32->background_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1772 /* No invisible pointers. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1773 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
1774 && 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
1775 f->output_data.w32->mouse_pixel = f->output_data.w32->foreground_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1776
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1777 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1778 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1779
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1780 /* 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
1781 count = x_catch_errors (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1782
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1783 if (!EQ (Qnil, Vx_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1784 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1785 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
1786 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1787 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1788 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1789 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
1790 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1791
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1792 if (!EQ (Qnil, Vx_nontext_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1793 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1794 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
1795 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1796 XINT (Vx_nontext_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1797 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1798 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1799 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
1800 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1801
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1802 if (!EQ (Qnil, Vx_mode_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1803 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1804 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
1805 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1806 XINT (Vx_mode_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1807 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1808 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1809 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
1810 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1811
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1812 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1813 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1814 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1815 cross_cursor
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1816 = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1817 XINT (Vx_sensitive_text_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1818 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1819 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1820 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1821
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1822 /* 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
1823 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
1824 x_uncatch_errors (FRAME_W32_DISPLAY (f), count);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1825
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1826 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1827 XColor fore_color, back_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1828
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1829 fore_color.pixel = f->output_data.w32->mouse_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1830 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
1831 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1832 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1833 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1834 &fore_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1835 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1836 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1837 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1838 &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1839 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1840 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1841 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1842 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1843 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1844 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1845 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1846 &fore_color, &back_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1847 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1848
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1849 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1850 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1851 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1852 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1853
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1854 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
1855 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
1856 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
1857
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1858 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
1859 && 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
1860 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
1861 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
1862
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1863 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
1864 && 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
1865 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
1866 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
1867 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
1868 && 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
1869 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
1870 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
1871
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1872 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1873 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1874 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1875 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1876
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1877 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1878 x_set_cursor_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1879 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1880 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1881 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1882 unsigned long fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1883
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1884 if (!EQ (Vx_cursor_fore_pixel, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1885 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1886 WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1887 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1888 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
1889 f->output_data.w32->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1890
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1891 /* 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
1892 if (f->output_data.w32->cursor_pixel == f->output_data.w32->background_pixel)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1893 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1894 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
1895 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
1896 fore_pixel = f->output_data.w32->background_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1897 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1898 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
1899
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1900 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1901 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1902 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1903 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1904 x_display_cursor (f, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1905 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1906 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1907 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1908 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1909
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1910 /* Set the border-color of frame F to value described by ARG.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1911 ARG can be a string naming a color.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1912 The border-color is used for the border that is drawn by the server.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1913 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1914 F has a window; it must be redone when the window is created. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1915
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1916 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1917 x_set_border_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1918 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1919 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1920 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1921 unsigned char *str;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1922 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1923
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1924 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1925 str = XSTRING (arg)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1926
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1927 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1928
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1929 x_set_border_pixel (f, pix);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1930 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1931
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1932 /* Set the border-color of frame F to pixel value PIX.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1933 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1934 F has an window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1935
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1936 x_set_border_pixel (f, pix)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1937 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1938 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1939 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1940 f->output_data.w32->border_pixel = pix;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1941
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1942 if (FRAME_W32_WINDOW (f) != 0 && f->output_data.w32->border_width > 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1943 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1944 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1945 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1946 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1947 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1948
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1949 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1950 x_set_cursor_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1951 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1952 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1953 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1954 if (EQ (arg, Qbar))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1955 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1956 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
1957 f->output_data.w32->cursor_width = 2;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1958 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1959 else if (CONSP (arg) && EQ (XCONS (arg)->car, Qbar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1960 && INTEGERP (XCONS (arg)->cdr))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1961 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1962 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
1963 f->output_data.w32->cursor_width = XINT (XCONS (arg)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1964 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1965 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1966 /* Treat anything unknown as "box cursor".
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1967 It was bad to signal an error; people have trouble fixing
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1968 .Xdefaults with Emacs, when it has something bad in it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1969 FRAME_DESIRED_CURSOR (f) = filled_box_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1970
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1971 /* Make sure the cursor gets redrawn. This is overkill, but how
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1972 often do people change cursor types? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1973 update_mode_lines++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1974 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1975
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1976 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1977 x_set_icon_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1978 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1979 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1980 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1981 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1982 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1983 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1984
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1985 if (STRINGP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1986 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1987 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1988 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1989 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1990 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1991 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1992
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1993 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1994 if (NILP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1995 result = x_text_icon (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1996 (char *) XSTRING ((!NILP (f->icon_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1997 ? f->icon_name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1998 : f->name))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1999 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2000 result = x_bitmap_icon (f, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2001
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2002 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2003 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2004 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2005 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2006 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2007
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2008 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2009 the new icon is not mapped, so map the window in its stead. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2010 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2011 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2012 #ifdef USE_X_TOOLKIT
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2013 XtPopup (f->output_data.w32->widget, XtGrabNone);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2014 #endif
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2015 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2016 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2017
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2018 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2019 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2020 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2021 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2022
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2023 /* Return non-nil if frame F wants a bitmap icon. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2024
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2025 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2026 x_icon_type (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2027 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2028 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2029 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2030
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2031 tem = assq_no_quit (Qicon_type, f->param_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2032 if (CONSP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2033 return XCONS (tem)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2034 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2035 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2036 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2037
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2038 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2039 x_set_icon_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2040 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2041 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2042 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2043 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2044 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2045
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2046 if (STRINGP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2047 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2048 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2049 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2050 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2051 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2052 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2053
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2054 f->icon_name = arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2055
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2056 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2057 if (f->output_data.w32->icon_bitmap != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2058 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2059
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2060 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2061
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2062 result = x_text_icon (f,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2063 (char *) XSTRING ((!NILP (f->icon_name)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2064 ? f->icon_name
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2065 : !NILP (f->title)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2066 ? f->title
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2067 : f->name))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2068
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2069 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2070 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2071 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2072 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2073 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2074
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2075 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2076 the new icon is not mapped, so map the window in its stead. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2077 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2078 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2079 #ifdef USE_X_TOOLKIT
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2080 XtPopup (f->output_data.w32->widget, XtGrabNone);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2081 #endif
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2082 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2083 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2084
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2085 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2086 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2087 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2088 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2089
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2090 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
2091 extern Lisp_Object x_new_fontset();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2092
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2093 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2094 x_set_font (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2095 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2096 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2097 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2098 Lisp_Object result;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2099 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
2100 Lisp_Object frame;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2101
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2102 CHECK_STRING (arg, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2103
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2104 fontset_name = Fquery_fontset (arg, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2105
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2106 BLOCK_INPUT;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2107 result = (STRINGP (fontset_name)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2108 ? 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
2109 : x_new_font (f, XSTRING (arg)->data));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2110 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2111
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2112 if (EQ (result, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2113 error ("Font \"%s\" is not defined", XSTRING (arg)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2114 else if (EQ (result, Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2115 error ("the characters of the given font have varying widths");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2116 else if (STRINGP (result))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2117 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2118 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2119 store_frame_param (f, Qfont, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2120 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2121 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2122 abort ();
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2123
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2124 XSETFRAME (frame, f);
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2125 call1 (Qface_set_after_frame_default, frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2126 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2127
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2128 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2129 x_set_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2130 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2131 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2132 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2133 CHECK_NUMBER (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2134
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2135 if (XINT (arg) == f->output_data.w32->border_width)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2136 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2137
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2138 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2139 error ("Cannot change the border width of a window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2140
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2141 f->output_data.w32->border_width = XINT (arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2142 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2143
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2144 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2145 x_set_internal_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2146 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2147 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2148 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2149 int mask;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2150 int old = f->output_data.w32->internal_border_width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2151
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2152 CHECK_NUMBER (arg, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2153 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
2154 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
2155 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
2156
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2157 if (f->output_data.w32->internal_border_width == old)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2158 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2159
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2160 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2161 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2162 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2163 x_set_window_size (f, 0, f->width, f->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2164 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2165 SET_FRAME_GARBAGED (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2166 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2167 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2168
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2169 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2170 x_set_visibility (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2171 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2172 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2173 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2174 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2175 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2176
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2177 if (NILP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2178 Fmake_frame_invisible (frame, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2179 else if (EQ (value, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2180 Ficonify_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2181 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2182 Fmake_frame_visible (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2183 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2184
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2185 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2186 x_set_menu_bar_lines (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2187 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2188 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2189 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2190 int nlines;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2191 int olines = FRAME_MENU_BAR_LINES (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2192
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2193 /* Right now, menu bars don't work properly in minibuf-only frames;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2194 most of the commands try to apply themselves to the minibuffer
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2195 frame itslef, and get an error because you can't switch buffers
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2196 in or split the minibuffer window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2197 if (FRAME_MINIBUF_ONLY_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2198 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2199
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2200 if (INTEGERP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2201 nlines = XINT (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2202 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2203 nlines = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2204
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2205 FRAME_MENU_BAR_LINES (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2206 if (nlines)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2207 FRAME_EXTERNAL_MENU_BAR (f) = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2208 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2209 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2210 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2211 free_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2212 FRAME_EXTERNAL_MENU_BAR (f) = 0;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2213
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2214 /* 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
2215 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
2216 set correctly. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2217 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2218 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2219 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2220
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2221 /* 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
2222 w32_id_name.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2223
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2224 If EXPLICIT is non-zero, that indicates that lisp code is setting the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2225 name; if NAME is a string, set F's name to NAME and set
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2226 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2227
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2228 If EXPLICIT is zero, that indicates that Emacs redisplay code is
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2229 suggesting a new name, which lisp code should override; if
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2230 F->explicit_name is set, ignore the new name; otherwise, set it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2231
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2232 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2233 x_set_name (f, name, explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2234 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2235 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2236 int explicit;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2237 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2238 /* Make sure that requests from lisp code override requests from
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2239 Emacs redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2240 if (explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2241 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2242 /* If we're switching from explicit to implicit, we had better
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2243 update the mode lines and thereby update the title. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2244 if (f->explicit_name && NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2245 update_mode_lines = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2246
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2247 f->explicit_name = ! NILP (name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2248 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2249 else if (f->explicit_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2250 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2251
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2252 /* If NAME is nil, set the name to the w32_id_name. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2253 if (NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2254 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2255 /* Check for no change needed in this very common case
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2256 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
2257 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2258 XSTRING (f->name)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2259 return;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2260 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2261 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2262 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2263 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2264
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2265 /* Don't change the name if it's already NAME. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2266 if (! NILP (Fstring_equal (name, f->name)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2267 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2268
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2269 f->name = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2270
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2271 /* 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
2272 the name parameter. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2273 if (! NILP (f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2274 name = f->title;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2275
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2276 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2277 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2278 BLOCK_INPUT;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2279 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2280 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2281 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2282 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2283
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2284 /* This function should be called when the user's lisp code has
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2285 specified a name for the frame; the name will override any set by the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2286 redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2287 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2288 x_explicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2289 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2290 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2291 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2292 x_set_name (f, arg, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2293 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2294
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2295 /* This function should be called by Emacs redisplay code to set the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2296 name; names set this way will never override names set by the user's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2297 lisp code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2298 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2299 x_implicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2300 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2301 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2302 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2303 x_set_name (f, arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2304 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2305
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2306 /* 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
2307 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
2308
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2309 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
2310 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
2311 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
2312
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2313 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
2314 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
2315 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
2316
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2317 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2318 x_set_title (f, name)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2319 struct frame *f;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2320 Lisp_Object name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2321 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2322 /* 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
2323 if (EQ (name, f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2324 return;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2325
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2326 update_mode_lines = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2327
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2328 f->title = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2329
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2330 if (NILP (name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2331 name = f->name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2332
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2333 if (FRAME_W32_WINDOW (f))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2334 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2335 BLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2336 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
2337 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2338 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2339 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2340
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2341 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2342 x_set_autoraise (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2343 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2344 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2345 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2346 f->auto_raise = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2347 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2348
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2349 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2350 x_set_autolower (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2351 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2352 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2353 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2354 f->auto_lower = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2355 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2356
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2357 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2358 x_set_unsplittable (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2359 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2360 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2361 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2362 f->no_split = !NILP (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2363 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2364
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2365 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2366 x_set_vertical_scroll_bars (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2367 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2368 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2369 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2370 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
2371 || (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
2372 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f))
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2373 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2374 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2375 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ?
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2376 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
2377 /* 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
2378 on MS-Windows. */
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2379 EQ (Qleft, arg)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2380 ? 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
2381 : vertical_scroll_bar_right;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2382
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2383 /* We set this parameter before creating the window for the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2384 frame, so we can get the geometry right from the start.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2385 However, if the window hasn't been created yet, we shouldn't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2386 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
2387 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2388 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2389 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2390 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2391
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2392 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2393 x_set_scroll_bar_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2394 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2395 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2396 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2397 if (NILP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2398 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2399 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2400 FRAME_SCROLL_BAR_COLS (f) = 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2401 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2402 else if (INTEGERP (arg) && XINT (arg) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2403 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2404 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2405 int wid = FONT_WIDTH (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2406 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2407 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
2408 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2409 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2410 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2411 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2412
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2413 /* Subroutines of creating an frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2414
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2415 /* Make sure that Vx_resource_name is set to a reasonable value.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2416 Fix it up, or set it to `emacs' if it is too hopeless. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2417
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2418 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2419 validate_x_resource_name ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2420 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2421 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2422 /* Number of valid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2423 int good_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2424 /* Number of invalid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2425 int bad_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2426 Lisp_Object new;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2427 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2428
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2429 if (STRINGP (Vx_resource_name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2430 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2431 unsigned char *p = XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2432 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2433
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2434 len = XSTRING (Vx_resource_name)->size;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2435
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2436 /* Only letters, digits, - and _ are valid in resource names.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2437 Count the valid characters and count the invalid ones. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2438 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2439 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2440 int c = p[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2441 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2442 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2443 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2444 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2445 bad_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2446 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2447 good_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2448 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2449 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2450 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2451 /* Not a string => completely invalid. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2452 bad_count = 5, good_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2453
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2454 /* If name is valid already, return. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2455 if (bad_count == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2456 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2457
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2458 /* If name is entirely invalid, or nearly so, use `emacs'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2459 if (good_count == 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2460 || (good_count == 1 && bad_count > 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2461 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2462 Vx_resource_name = build_string ("emacs");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2463 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2464 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2465
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2466 /* Name is partly valid. Copy it and replace the invalid characters
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2467 with underscores. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2468
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2469 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2470
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2471 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2472 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2473 int c = XSTRING (new)->data[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2474 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2475 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2476 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2477 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2478 XSTRING (new)->data[i] = '_';
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2479 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2480 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2481
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2482
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2483 extern char *x_get_string_resource ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2484
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2485 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2486 "Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2487 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2488 class, where INSTANCE is the name under which Emacs was invoked, or\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2489 the name specified by the `-name' or `-rn' command-line arguments.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2490 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2491 The optional arguments COMPONENT and SUBCLASS add to the key and the\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2492 class, respectively. You must specify both of them or neither.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2493 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2494 and the class is `Emacs.CLASS.SUBCLASS'.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2495 (attribute, class, component, subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2496 Lisp_Object attribute, class, component, subclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2497 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2498 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2499 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2500 char *class_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2501
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2502 CHECK_STRING (attribute, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2503 CHECK_STRING (class, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2504
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2505 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2506 CHECK_STRING (component, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2507 if (!NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2508 CHECK_STRING (subclass, 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2509 if (NILP (component) != NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2510 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2511
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2512 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2513
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2514 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2515 and the final '\0'. Make them big enough for the worst case. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2516 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2517 + (STRINGP (component)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2518 ? XSTRING (component)->size : 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2519 + XSTRING (attribute)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2520 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2521
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2522 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2523 + XSTRING (class)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2524 + (STRINGP (subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2525 ? XSTRING (subclass)->size : 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2526 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2527
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2528 /* Start with emacs.FRAMENAME for the name (the specific one)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2529 and with `Emacs' for the class key (the general one). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2530 strcpy (name_key, XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2531 strcpy (class_key, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2532
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2533 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2534 strcat (class_key, XSTRING (class)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2535
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2536 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2537 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2538 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2539 strcat (class_key, XSTRING (subclass)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2540
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2541 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2542 strcat (name_key, XSTRING (component)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2543 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2544
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2545 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2546 strcat (name_key, XSTRING (attribute)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2547
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2548 value = x_get_string_resource (Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2549 name_key, class_key);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2550
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2551 if (value != (char *) 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2552 return build_string (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2553 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2554 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2555 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2556
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2557 /* Used when C code wants a resource value. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2558
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2559 char *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2560 x_get_resource_string (attribute, class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2561 char *attribute, *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2562 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2563 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2564 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2565 char *class_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2566
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2567 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2568 and the final '\0'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2569 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2570 + strlen (attribute) + 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2571 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2572 + strlen (class) + 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2573
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2574 sprintf (name_key, "%s.%s",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2575 XSTRING (Vinvocation_name)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2576 attribute);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2577 sprintf (class_key, "%s.%s", EMACS_CLASS, class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2578
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2579 return x_get_string_resource (selected_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2580 name_key, class_key);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2581 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2582
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2583 /* Types we might convert a resource string into. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2584 enum resource_types
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2585 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2586 number, boolean, string, symbol
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2587 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2588
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2589 /* Return the value of parameter PARAM.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2590
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2591 First search ALIST, then Vdefault_frame_alist, then the X defaults
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2592 database, using ATTRIBUTE as the attribute name and CLASS as its class.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2593
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2594 Convert the resource to the type specified by desired_type.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2595
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2596 If no default is specified, return Qunbound. If you call
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2597 x_get_arg, make sure you deal with Qunbound in a reasonable way,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2598 and don't let it get stored in any Lisp-visible variables! */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2599
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2600 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2601 x_get_arg (alist, param, attribute, class, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2602 Lisp_Object alist, param;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2603 char *attribute;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2604 char *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2605 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2606 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2607 register Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2608
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2609 tem = Fassq (param, alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2610 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2611 tem = Fassq (param, Vdefault_frame_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2612 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2613 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2614
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2615 if (attribute)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2616 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2617 tem = Fx_get_resource (build_string (attribute),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2618 build_string (class),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2619 Qnil, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2620
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2621 if (NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2622 return Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2623
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2624 switch (type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2625 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2626 case number:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2627 return make_number (atoi (XSTRING (tem)->data));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2628
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2629 case boolean:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2630 tem = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2631 if (!strcmp (XSTRING (tem)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2632 || !strcmp (XSTRING (tem)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2633 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2634 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2635 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2636
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2637 case string:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2638 return tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2639
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2640 case symbol:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2641 /* As a special case, we map the values `true' and `on'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2642 to Qt, and `false' and `off' to Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2643 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2644 Lisp_Object lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2645 lower = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2646 if (!strcmp (XSTRING (lower)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2647 || !strcmp (XSTRING (lower)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2648 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2649 else if (!strcmp (XSTRING (lower)->data, "off")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2650 || !strcmp (XSTRING (lower)->data, "false"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2651 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2652 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2653 return Fintern (tem, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2654 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2655
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2656 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2657 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2658 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2659 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2660 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2661 return Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2662 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2663 return Fcdr (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2664 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2665
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2666 /* Record in frame F the specified or default value according to ALIST
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2667 of the parameter named PARAM (a Lisp symbol).
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2668 If no value is specified for PARAM, look for an X default for XPROP
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2669 on the frame named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2670 If that is not found either, use the value DEFLT. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2671
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2672 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2673 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2674 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2675 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2676 Lisp_Object prop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2677 Lisp_Object deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2678 char *xprop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2679 char *xclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2680 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2681 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2682 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2683
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2684 tem = x_get_arg (alist, prop, xprop, xclass, type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2685 if (EQ (tem, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2686 tem = deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2687 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2688 return tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2689 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2690
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2691 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2692 "Parse an X-style geometry string STRING.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2693 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2694 The properties returned may include `top', `left', `height', and `width'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2695 The value of `left' or `top' may be an integer,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2696 or a list (+ N) meaning N pixels relative to top/left corner,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2697 or a list (- N) meaning -N pixels relative to bottom/right corner.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2698 (string)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2699 Lisp_Object string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2700 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2701 int geometry, x, y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2702 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2703 Lisp_Object result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2704
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2705 CHECK_STRING (string, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2706
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2707 geometry = XParseGeometry ((char *) XSTRING (string)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2708 &x, &y, &width, &height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2709
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2710 result = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2711 if (geometry & XValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2712 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2713 Lisp_Object element;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2714
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2715 if (x >= 0 && (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2716 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2717 else if (x < 0 && ! (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2718 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2719 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2720 element = Fcons (Qleft, make_number (x));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2721 result = Fcons (element, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2722 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2723
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2724 if (geometry & YValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2725 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2726 Lisp_Object element;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2727
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2728 if (y >= 0 && (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2729 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2730 else if (y < 0 && ! (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2731 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2732 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2733 element = Fcons (Qtop, make_number (y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2734 result = Fcons (element, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2735 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2736
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2737 if (geometry & WidthValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2738 result = Fcons (Fcons (Qwidth, make_number (width)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2739 if (geometry & HeightValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2740 result = Fcons (Fcons (Qheight, make_number (height)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2741
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2742 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2743 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2744
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2745 /* Calculate the desired size and position of this window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2746 and return the flags saying which aspects were specified.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2747
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2748 This function does not make the coordinates positive. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2749
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2750 #define DEFAULT_ROWS 40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2751 #define DEFAULT_COLS 80
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2752
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2753 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2754 x_figure_window_size (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2755 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2756 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2757 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2758 register Lisp_Object tem0, tem1, tem2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2759 int height, width, left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2760 register int geometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2761 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2762
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2763 /* Default values if we fall through.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2764 Actually, if that happens we should get
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2765 window manager prompting. */
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2766 SET_FRAME_WIDTH (f, DEFAULT_COLS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2767 f->height = DEFAULT_ROWS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2768 /* Window managers expect that if program-specified
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2769 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
2770 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
2771 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2772
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2773 tem0 = x_get_arg (parms, Qheight, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2774 tem1 = x_get_arg (parms, Qwidth, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2775 tem2 = x_get_arg (parms, Quser_size, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2776 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2777 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2778 if (!EQ (tem0, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2779 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2780 CHECK_NUMBER (tem0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2781 f->height = XINT (tem0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2782 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2783 if (!EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2784 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2785 CHECK_NUMBER (tem1, 0);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2786 SET_FRAME_WIDTH (f, XINT (tem1));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2787 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2788 if (!NILP (tem2) && !EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2789 window_prompting |= USSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2790 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2791 window_prompting |= PSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2792 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2793
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2794 f->output_data.w32->vertical_scroll_bar_extra
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2795 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2796 ? 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2797 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2798 ? 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
2799 : (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
2800 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
2801 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2802
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2803 tem0 = x_get_arg (parms, Qtop, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2804 tem1 = x_get_arg (parms, Qleft, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2805 tem2 = x_get_arg (parms, Quser_position, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2806 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2807 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2808 if (EQ (tem0, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2809 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2810 f->output_data.w32->top_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2811 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2812 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2813 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2814 && CONSP (XCONS (tem0)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2815 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2816 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2817 f->output_data.w32->top_pos = - XINT (XCONS (XCONS (tem0)->cdr)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2818 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2819 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2820 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2821 && CONSP (XCONS (tem0)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2822 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2823 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2824 f->output_data.w32->top_pos = XINT (XCONS (XCONS (tem0)->cdr)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2825 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2826 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
2827 f->output_data.w32->top_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2828 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2829 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2830 CHECK_NUMBER (tem0, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2831 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
2832 if (f->output_data.w32->top_pos < 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2833 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2834 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2835
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2836 if (EQ (tem1, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2837 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2838 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2839 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2840 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2841 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2842 && CONSP (XCONS (tem1)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2843 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2844 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2845 f->output_data.w32->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2846 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2847 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2848 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2849 && CONSP (XCONS (tem1)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2850 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2851 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2852 f->output_data.w32->left_pos = XINT (XCONS (XCONS (tem1)->cdr)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2853 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2854 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
2855 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2856 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2857 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2858 CHECK_NUMBER (tem1, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2859 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
2860 if (f->output_data.w32->left_pos < 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2861 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2862 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2863
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2864 if (!NILP (tem2) && ! EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2865 window_prompting |= USPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2866 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2867 window_prompting |= PPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2868 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2869
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2870 return window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2871 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2872
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2873
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2874
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2875 extern LRESULT CALLBACK w32_wnd_proc ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2876
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2877 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2878 w32_init_class (hinst)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2879 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2880 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2881 WNDCLASS wc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2882
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2883 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
2884 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2885 wc.cbClsExtra = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2886 wc.cbWndExtra = WND_EXTRA_BYTES;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2887 wc.hInstance = hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2888 wc.hIcon = LoadIcon (hinst, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2889 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
2890 wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2891 wc.lpszMenuName = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2892 wc.lpszClassName = EMACS_CLASS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2893
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2894 return (RegisterClass (&wc));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2895 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2896
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2897 HWND
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2898 w32_createscrollbar (f, bar)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2899 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2900 struct scroll_bar * bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2901 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2902 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2903 /* Position and size of scroll bar. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2904 XINT(bar->left), XINT(bar->top),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2905 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
2906 FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2907 NULL,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2908 hinst,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2909 NULL));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2910 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2911
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2912 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2913 w32_createwindow (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2914 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2915 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2916 HWND hwnd;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2917 RECT rect;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2918
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2919 rect.left = rect.top = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2920 rect.right = PIXEL_WIDTH (f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2921 rect.bottom = PIXEL_HEIGHT (f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2922
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2923 AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2924 FRAME_EXTERNAL_MENU_BAR (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2925
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2926 /* Do first time app init */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2927
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2928 if (!hprevinst)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2929 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2930 w32_init_class (hinst);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2931 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2932
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2933 FRAME_W32_WINDOW (f) = hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2934 = CreateWindow (EMACS_CLASS,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2935 f->namebuf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2936 f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2937 f->output_data.w32->left_pos,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2938 f->output_data.w32->top_pos,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2939 rect.right - rect.left,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2940 rect.bottom - rect.top,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2941 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2942 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2943 hinst,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2944 NULL);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2945
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2946 if (hwnd)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2947 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2948 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
2949 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
2950 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
2951 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
2952 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
2953
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
2954 /* Enable drag-n-drop. */
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
2955 DragAcceptFiles (hwnd, TRUE);
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
2956
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2957 /* 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
2958 ShowWindow (hwnd, SW_HIDE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2959 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2960 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2961
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2962 /* Convert between the modifier bits W32 uses and the modifier bits
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2963 Emacs uses. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2964 unsigned int
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2965 w32_get_modifiers ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2966 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2967 return (((GetKeyState (VK_SHIFT)&0x8000) ? shift_modifier : 0) |
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2968 ((GetKeyState (VK_CONTROL)&0x8000) ? ctrl_modifier : 0) |
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
2969 ((GetKeyState (VK_MENU)&0x8000) ?
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2970 ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier) : 0));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2971 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2972
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2973 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2974 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
2975 W32Msg * wmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2976 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2977 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2978 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2979 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2980 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2981 wmsg->msg.hwnd = hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2982 wmsg->msg.message = msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2983 wmsg->msg.wParam = wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2984 wmsg->msg.lParam = lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2985 wmsg->msg.time = GetMessageTime ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2986
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2987 post_msg (wmsg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2988 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2989
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
2990 /* 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
2991 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
2992 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
2993 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
2994 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
2995 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
2996 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
2997 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
2998 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
2999 on Swedish keyboards). */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3000
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3001 #define EMACS_LCONTROL 0
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3002 #define EMACS_RCONTROL 1
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3003 #define EMACS_LMENU 2
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3004 #define EMACS_RMENU 3
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3005
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3006 static int modifiers[4];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3007 static int modifiers_recorded;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3008 static int modifier_key_support_tested;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3009
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3010 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3011 test_modifier_support (unsigned int wparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3012 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3013 unsigned int l, r;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3014
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3015 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3016 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3017 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3018 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3019 l = VK_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3020 r = VK_RCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3021 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3022 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3023 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3024 l = VK_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3025 r = VK_RMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3026 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3027 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000))
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3028 modifiers_recorded = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3029 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3030 modifiers_recorded = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3031 modifier_key_support_tested = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3032 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3033
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3034 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3035 record_keydown (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3036 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3037 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3038
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3039 if (!modifier_key_support_tested)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3040 test_modifier_support (wparam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3041
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3042 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
3043 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3044
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3045 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3046 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3047 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3048 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
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 modifiers[i] = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3051 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3052
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3053 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3054 record_keyup (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3055 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3056 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3057
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3058 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
3059 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3060
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3061 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3062 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3063 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3064 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3065
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3066 modifiers[i] = 0;
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
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3069 /* 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
3070 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
3071 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
3072 static void
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3073 reset_modifiers ()
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3074 {
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3075 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
3076
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3077 if (!modifiers_recorded)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3078 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
3079
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3080 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
3081 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
3082
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3083 if (ctrl == 0 || alt == 0)
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3084 /* Emacs doesn't have keyboard focus. Do nothing. */
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3085 return;
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3086
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3087 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
3088 /* 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
3089 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
3090
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3091 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
3092 /* 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
3093 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
3094
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3095 /* Otherwise, leave the modifier state as it was when Emacs lost
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3096 keyboard focus. */
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3097 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3098
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3099 /* 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
3100 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
3101 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
3102 the left or right modifier should be set. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3103 static void
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3104 sync_modifiers ()
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3105 {
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3106 if (!modifiers_recorded)
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3107 return;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3108
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3109 if (!(GetKeyState (VK_CONTROL) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3110 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3111
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3112 if (!(GetKeyState (VK_MENU) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3113 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3114 }
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3115
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3116 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3117 modifier_set (int vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3118 {
15280
f39684fddaff (modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents: 15232
diff changeset
3119 if (vkey == VK_CAPITAL)
f39684fddaff (modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents: 15232
diff changeset
3120 return (GetKeyState (vkey) & 0x1);
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3121 if (!modifiers_recorded)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3122 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3123
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3124 switch (vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3125 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3126 case VK_LCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3127 return modifiers[EMACS_LCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3128 case VK_RCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3129 return modifiers[EMACS_RCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3130 case VK_LMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3131 return modifiers[EMACS_LMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3132 case VK_RMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3133 return modifiers[EMACS_RMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3134 default:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3135 break;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3136 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3137 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3138 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3139
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3140 /* 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
3141 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
3142 and window input. */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3143
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3144 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3145 construct_modifiers (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3146 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3147 int mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3148
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3149 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3150 mods = GetLastError ();
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3151
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3152 mods = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3153 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3154 mods |= (modifier_set (VK_CAPITAL)) ? CAPSLOCK_ON : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3155 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
3156 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
3157 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
3158 mods |= (modifier_set (VK_RMENU)) ? RIGHT_ALT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3159
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3160 return mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3161 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3162
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3163 static unsigned int
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3164 map_keypad_keys (unsigned int wparam, unsigned int lparam)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3165 {
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3166 unsigned int extended = (lparam & 0x1000000L);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3167
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3168 if (wparam < VK_CLEAR || wparam > VK_DELETE)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3169 return wparam;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3170
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3171 if (wparam == VK_RETURN)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3172 return (extended ? VK_NUMPAD_ENTER : VK_RETURN);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3173
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3174 if (wparam >= VK_PRIOR && wparam <= VK_DOWN)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3175 return (!extended ? (VK_NUMPAD_PRIOR + (wparam - VK_PRIOR)) : wparam);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3176
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3177 if (wparam == VK_INSERT || wparam == VK_DELETE)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3178 return (!extended ? (VK_NUMPAD_INSERT + (wparam - VK_INSERT)) : wparam);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3179
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3180 if (wparam == VK_CLEAR)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3181 return (!extended ? VK_NUMPAD_CLEAR : wparam);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3182
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3183 return wparam;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3184 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3185
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3186 /* Main message dispatch loop. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3187
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3188 static void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3189 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
3190 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3191 MSG msg;
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3192
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3193 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
3194
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3195 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
3196 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3197 if (msg.hwnd == NULL)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3198 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3199 switch (msg.message)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3200 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3201 case WM_EMACS_CREATEWINDOW:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3202 w32_createwindow ((struct frame *) msg.wParam);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3203 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
3204 abort ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3205 break;
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3206 case WM_EMACS_SETLOCALE:
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3207 SetThreadLocale (msg.wParam);
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3208 /* Reply is not expected. */
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3209 break;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3210 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3211 /* No need to be so draconian! */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3212 /* abort (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3213 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
3214 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3215 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3216 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3217 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3218 DispatchMessage (&msg);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3219 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3220
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3221 /* 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
3222 if (msg_buf->completed)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3223 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3224 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3225 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3226
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3227 deferred_msg * deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3228
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3229 static deferred_msg *
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3230 find_deferred_msg (HWND hwnd, UINT msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3231 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3232 deferred_msg * item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3233
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3234 /* 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
3235 modification of single pointer is always atomic. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3236 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3237
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3238 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
3239 if (item->w32msg.msg.hwnd == hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3240 && item->w32msg.msg.message == msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3241 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3242
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3243 /* leave_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3244
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3245 return item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3246 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3247
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3248 static LRESULT
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3249 send_deferred_msg (deferred_msg * msg_buf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3250 HWND hwnd,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3251 UINT msg,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3252 WPARAM wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3253 LPARAM lParam)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3254 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3255 /* Only input thread can send deferred messages. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3256 if (GetCurrentThreadId () != dwWindowsThreadId)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3257 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3258
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3259 /* 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
3260 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3261 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3262
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3263 /* 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
3264 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
3265 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
3266 input thread can call us). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3267
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3268 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3269
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3270 msg_buf->completed = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3271 msg_buf->next = deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3272 deferred_msg_head = msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3273 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
3274
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3275 /* leave_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3276
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3277 /* 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
3278 this one is completed. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3279 w32_msg_pump (msg_buf);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3280
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3281 deferred_msg_head = msg_buf->next;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3282
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3283 return msg_buf->result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3284 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3285
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3286 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3287 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
3288 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3289 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
3290
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3291 if (msg_buf == NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3292 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3293
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3294 msg_buf->result = result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3295 msg_buf->completed = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3296
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3297 /* 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
3298 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3299 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3300
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3301
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3302 DWORD
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3303 w32_msg_worker (dw)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3304 DWORD dw;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3305 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3306 MSG msg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3307 deferred_msg dummy_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3308
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3309 /* 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
3310
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3311 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3312
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3313 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
3314 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3315
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3316 memset (&dummy_buf, 0, sizeof (dummy_buf));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3317 dummy_buf.w32msg.msg.hwnd = NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3318 dummy_buf.w32msg.msg.message = WM_NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3319
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3320 /* 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
3321 application quits. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3322 w32_msg_pump (&dummy_buf);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3323
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3324 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3325 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3326
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3327 /* Main window procedure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3328
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3329 extern char *lispy_function_keys[];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3330
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3331 LRESULT CALLBACK
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3332 w32_wnd_proc (hwnd, msg, wParam, lParam)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3333 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3334 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3335 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3336 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3337 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3338 struct frame *f;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3339 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
3340 W32Msg wmsg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3341 int windows_translate;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3342
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3343 /* 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
3344 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
3345 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
3346 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
3347 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
3348
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3349 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
3350 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
3351 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
3352 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
3353 delete-frame has synchronized with this thread.
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3354
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3355 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
3356 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
3357 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
3358
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3359 switch (msg)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3360 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3361 case WM_ERASEBKGND:
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3362 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3363 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3364 {
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3365 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
3366 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
3367 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3368 return 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3369 case WM_PALETTECHANGED:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3370 /* ignore our own changes */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3371 if ((HWND)wParam != hwnd)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3372 {
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3373 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3374 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3375 /* 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
3376 frames to be redrawn if needed. */
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3377 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
3378 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3379 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3380 case WM_PAINT:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3381 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3382 PAINTSTRUCT paintStruct;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3383
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3384 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3385 BeginPaint (hwnd, &paintStruct);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3386 wmsg.rect = paintStruct.rcPaint;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3387 EndPaint (hwnd, &paintStruct);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3388 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3389
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3390 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3391
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3392 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3393 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3394
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3395 case WM_KEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3396 case WM_SYSKEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3397 record_keyup (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3398 goto dflt;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3399
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3400 case WM_KEYDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3401 case WM_SYSKEYDOWN:
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3402 /* Synchronize modifiers with current keystroke. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3403 sync_modifiers ();
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3404
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3405 record_keydown (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3406
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3407 wParam = map_keypad_keys (wParam, lParam);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3408
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3409 windows_translate = 0;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3410 switch (wParam) {
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3411 case VK_LWIN:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3412 case VK_RWIN:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3413 case VK_APPS:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3414 /* More support for these keys will likely be necessary. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3415 if (!NILP (Vw32_pass_optional_keys_to_system))
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3416 windows_translate = 1;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3417 break;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3418 case VK_MENU:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3419 if (NILP (Vw32_pass_alt_to_system))
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3420 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3421 windows_translate = 1;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3422 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3423 case VK_CONTROL:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3424 case VK_CAPITAL:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3425 case VK_SHIFT:
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3426 case VK_NUMLOCK:
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3427 case VK_SCROLL:
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3428 windows_translate = 1;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3429 break;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3430 default:
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3431 /* If not defined as a function key, change it to a WM_CHAR message. */
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3432 if (lispy_function_keys[wParam] == 0)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3433 msg = WM_CHAR;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3434 break;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3435 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3436
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3437 if (windows_translate)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3438 {
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3439 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
3440
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3441 windows_msg.time = GetMessageTime ();
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3442 TranslateMessage (&windows_msg);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3443 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3444 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3445
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3446 /* Fall through */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3447
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3448 case WM_SYSCHAR:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3449 case WM_CHAR:
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3450 wmsg.dwModifiers = construct_modifiers (wParam, lParam);
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3451
15232
4c4924843e34 (win32_wnd_proc): Reenable quit_char detection.
Richard M. Stallman <rms@gnu.org>
parents: 15206
diff changeset
3452 #if 1
16602
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3453 /* Detect quit_char and set quit-flag directly. Note that we
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3454 still need to post a message to ensure the main thread will be
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3455 woken up if blocked in sys_select(), but we do NOT want to post
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3456 the quit_char message itself (because it will usually be as if
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3457 the user had typed quit_char twice). Instead, we post a dummy
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3458 message that has no particular effect. */
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3459 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3460 int c = wParam;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3461 if (isalpha (c) && (wmsg.dwModifiers == LEFT_CTRL_PRESSED
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3462 || wmsg.dwModifiers == RIGHT_CTRL_PRESSED))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3463 c = make_ctrl_char (c) & 0377;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3464 if (c == quit_char)
16602
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3465 {
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3466 Vquit_flag = Qt;
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3467
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3468 /* The choice of message is somewhat arbitrary, as long as
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3469 the main thread handler just ignores it. */
22078
f4099a0f3575 (w32_wnd_proc): Call signal_quit when C-g is received.
Richard M. Stallman <rms@gnu.org>
parents: 21896
diff changeset
3470 msg = WM_NULL;
f4099a0f3575 (w32_wnd_proc): Call signal_quit when C-g is received.
Richard M. Stallman <rms@gnu.org>
parents: 21896
diff changeset
3471
f4099a0f3575 (w32_wnd_proc): Call signal_quit when C-g is received.
Richard M. Stallman <rms@gnu.org>
parents: 21896
diff changeset
3472 /* Interrupt any blocking system calls. */
f4099a0f3575 (w32_wnd_proc): Call signal_quit when C-g is received.
Richard M. Stallman <rms@gnu.org>
parents: 21896
diff changeset
3473 signal_quit ();
16602
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3474 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3475 }
15206
16d0e8c36378 (win32_wnd_proc): Disable setting of Vquit_flag
Geoff Voelker <voelker@cs.washington.edu>
parents: 15205
diff changeset
3476 #endif
16d0e8c36378 (win32_wnd_proc): Disable setting of Vquit_flag
Geoff Voelker <voelker@cs.washington.edu>
parents: 15205
diff changeset
3477
16602
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3478 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
510d37fcbaf6 (w32_wnd_proc): Use dummy message to wake up thread on quit_char.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16593
diff changeset
3479
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3480 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3481
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3482 /* 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
3483 are used together, but only if user has two button mouse. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3484 case WM_LBUTTONDOWN:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3485 case WM_RBUTTONDOWN:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3486 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
3487 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3488
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3489 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3490 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
3491 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
3492
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3493 if (button_state & this)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3494 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3495
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3496 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3497 SetCapture (hwnd);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3498
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3499 button_state |= this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3500
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3501 if (button_state & other)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3502 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3503 if (mouse_button_timer)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3504 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3505 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3506 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3507
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3508 /* Generate middle mouse event instead. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3509 msg = WM_MBUTTONDOWN;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3510 button_state |= MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3511 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3512 else if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3513 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3514 /* 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
3515 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
3516 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
3517 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
3518 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3519 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3520 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3521 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3522 /* Flush out saved message. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3523 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
3524 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3525 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
3526 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
3527
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3528 /* Clear message buffer. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3529 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
3530 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3531 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3532 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3533 /* Hold onto message for now. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3534 mouse_button_timer =
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3535 SetTimer (hwnd, MOUSE_BUTTON_ID, XINT (Vw32_mouse_button_tolerance), NULL);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3536 saved_mouse_button_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3537 saved_mouse_button_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3538 saved_mouse_button_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3539 saved_mouse_button_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3540 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
3541 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
3542 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3543 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3544 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3545
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3546 case WM_LBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3547 case WM_RBUTTONUP:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3548 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
3549 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3550
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3551 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3552 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
3553 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
3554
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3555 if ((button_state & this) == 0)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3556 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3557
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3558 button_state &= ~this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3559
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3560 if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3561 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3562 /* 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
3563 if ((button_state & other) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3564 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3565 msg = WM_MBUTTONUP;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3566 button_state &= ~MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3567
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3568 if (button_state) abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3569 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3570 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3571 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3572 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3573 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3574 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3575 /* Flush out saved message if necessary. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3576 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
3577 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3578 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
3579 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3580 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3581 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
3582 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
3583
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3584 /* 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
3585 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3586 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3587 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3588
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3589 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3590 ReleaseCapture ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3591 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3592 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3593
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3594 case WM_MBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3595 case WM_MBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3596 handle_plain_button:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3597 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3598 BOOL up;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3599 int button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3600
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3601 if (parse_button (msg, &button, &up))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3602 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3603 if (up) ReleaseCapture ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3604 else SetCapture (hwnd);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3605 button = (button == 0) ? LMOUSE :
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3606 ((button == 1) ? MMOUSE : RMOUSE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3607 if (up)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3608 button_state &= ~button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3609 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3610 button_state |= button;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3611 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3612 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3613
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3614 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3615 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
3616 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3617
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3618 case WM_VSCROLL:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3619 case WM_MOUSEMOVE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3620 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
3621 || (msg == WM_MOUSEMOVE && button_state == 0))
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3622 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3623 wmsg.dwModifiers = w32_get_modifiers ();
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3624 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
3625 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3626 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3627
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3628 /* 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
3629 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
3630 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
3631 expires, we just replace the first message. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3632
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3633 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
3634 mouse_move_timer =
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3635 SetTimer (hwnd, MOUSE_MOVE_ID, XINT (Vw32_mouse_move_interval), NULL);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3636
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3637 /* Hold onto message for now. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3638 saved_mouse_move_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3639 saved_mouse_move_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3640 saved_mouse_move_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3641 saved_mouse_move_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3642 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
3643 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
3644
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3645 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3646
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3647 case WM_MOUSEWHEEL:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3648 wmsg.dwModifiers = w32_get_modifiers ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3649 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
3650 return 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3651
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3652 case WM_DROPFILES:
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3653 wmsg.dwModifiers = w32_get_modifiers ();
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3654 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3655 return 0;
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3656
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3657 case WM_TIMER:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3658 /* Flush out saved messages if necessary. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3659 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
3660 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3661 if (saved_mouse_button_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3662 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3663 post_msg (&saved_mouse_button_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3664 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3665 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3666 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3667 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3668 }
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3669 else if (wParam == mouse_move_timer)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3670 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3671 if (saved_mouse_move_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3672 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3673 post_msg (&saved_mouse_move_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3674 saved_mouse_move_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3675 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3676 KillTimer (hwnd, mouse_move_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3677 mouse_move_timer = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3678 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3679 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3680
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3681 case WM_NCACTIVATE:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3682 /* 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
3683 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
3684 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
3685 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
3686 keyboard modifiers' state. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3687 reset_modifiers ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3688 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3689
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3690 case WM_INITMENU:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3691 /* 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
3692 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
3693 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
3694 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
3695 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
3696
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3697 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
3698 loop that can process all other messages.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3699
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3700 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
3701 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
3702 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
3703 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
3704 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
3705 being active). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3706
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3707 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3708 if (f
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3709 && (f->output_data.w32->menubar_active
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3710 /* 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
3711 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
3712 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
3713 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
3714 had requested it to be turned off! */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3715 || f->output_data.w32->menubar_widget == NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3716 return 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3717
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3718 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3719 deferred_msg msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3720
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3721 /* 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
3722 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
3723 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3724 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3725
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3726 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
3727 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3728
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3729 case WM_EXITMENULOOP:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3730 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3731
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3732 /* Indicate that menubar can be modified again. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3733 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3734 f->output_data.w32->menubar_active = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3735 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3736
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3737 case WM_MEASUREITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3738 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
3739 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3740 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3741 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
3742
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3743 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
3744 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3745 /* 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
3746 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
3747 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
3748 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
3749 LOGFONT menu_logfont;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3750 HFONT old_font;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3751 SIZE size;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3752
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3753 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
3754 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
3755 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
3756 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
3757
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3758 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
3759 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
3760 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
3761 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
3762 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
3763
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3764 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
3765 DeleteObject (menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3766 ReleaseDC (hwnd, hdc);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3767 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3768 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3769 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3770 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3771
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3772 case WM_DRAWITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3773 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
3774 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3775 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3776 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
3777
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3778 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
3779 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3780 /* 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
3781 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
3782 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
3783 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
3784 LOGFONT menu_logfont;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3785 HFONT old_font;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3786
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3787 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
3788 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
3789 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
3790 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
3791
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3792 /* 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
3793 ExtTextOut (hdc,
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3794 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
3795 pDis->rcItem.top,
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3796 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
3797 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
3798
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3799 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
3800 DeleteObject (menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3801 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3802 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3803 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3804 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3805
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3806 #if 0
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3807 /* 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
3808 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
3809 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
3810 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
3811 case WM_MOUSEACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3812 /* 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
3813 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
3814 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
3815 if (LOWORD (lParam) == HTCLIENT )
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3816 return MA_ACTIVATEANDEAT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3817 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3818 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3819
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3820 case WM_ACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3821 case WM_ACTIVATEAPP:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3822 case WM_WINDOWPOSCHANGED:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3823 case WM_SHOWWINDOW:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3824 /* 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
3825 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
3826 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
3827 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3828
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3829 case WM_SETFOCUS:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3830 reset_modifiers ();
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3831 case WM_KILLFOCUS:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3832 case WM_MOVE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3833 case WM_SIZE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3834 case WM_COMMAND:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3835 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3836 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3837 goto dflt;
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3838
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3839 case WM_CLOSE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3840 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
3841 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
3842 return 0;
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3843
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3844 case WM_WINDOWPOSCHANGING:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3845 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3846 WINDOWPLACEMENT wp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3847 LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3848
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3849 wp.length = sizeof (WINDOWPLACEMENT);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3850 GetWindowPlacement (hwnd, &wp);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3851
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3852 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3853 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3854 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3855 int wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3856 int hdiff;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3857 DWORD font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3858 DWORD line_height;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3859 DWORD internal_border;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3860 DWORD scrollbar_extra;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3861 RECT wr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3862
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3863 wp.length = sizeof(wp);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3864 GetWindowRect (hwnd, &wr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3865
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3866 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3867
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3868 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3869 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3870 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3871 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3872
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3873 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3874
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3875 memset (&rect, 0, sizeof (rect));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3876 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3877 GetMenu (hwnd) != NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3878
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3879 /* 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
3880 multiples of the character cell dimensions. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3881 wdiff = (lppos->cx - (rect.right - rect.left)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3882 - 2 * internal_border - scrollbar_extra)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3883 % font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3884 hdiff = (lppos->cy - (rect.bottom - rect.top)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3885 - 2 * internal_border)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3886 % line_height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3887
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3888 if (wdiff || hdiff)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3889 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3890 /* For right/bottom sizing we can just fix the sizes.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3891 However for top/left sizing we will need to fix the X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3892 and Y positions as well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3893
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3894 lppos->cx -= wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3895 lppos->cy -= hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3896
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3897 if (wp.showCmd != SW_SHOWMAXIMIZED
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3898 && (lppos->flags & SWP_NOMOVE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3899 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3900 if (lppos->x != wr.left || lppos->y != wr.top)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3901 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3902 lppos->x += wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3903 lppos->y += hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3904 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3905 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3906 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3907 lppos->flags |= SWP_NOMOVE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3908 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3909 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3910
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3911 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3912 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3913 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3914 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3915
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3916 goto dflt;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3917
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3918 case WM_EMACS_CREATESCROLLBAR:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3919 return (LRESULT) w32_createscrollbar ((struct frame *) wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3920 (struct scroll_bar *) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3921
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3922 case WM_EMACS_SHOWWINDOW:
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3923 return ShowWindow ((HWND) wParam, (WPARAM) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3924
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3925 case WM_EMACS_SETFOREGROUND:
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3926 return SetForegroundWindow ((HWND) wParam);
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3927
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3928 case WM_EMACS_SETWINDOWPOS:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3929 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3930 WINDOWPOS * pos = (WINDOWPOS *) wParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3931 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
3932 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
3933 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3934
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3935 case WM_EMACS_DESTROYWINDOW:
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3936 DragAcceptFiles ((HWND) wParam, FALSE);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3937 return DestroyWindow ((HWND) wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3938
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3939 case WM_EMACS_TRACKPOPUPMENU:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3940 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3941 UINT flags;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3942 POINT *pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3943 int retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3944 pos = (POINT *)lParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3945 flags = TPM_CENTERALIGN;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3946 if (button_state & LMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3947 flags |= TPM_LEFTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3948 else if (button_state & RMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3949 flags |= TPM_RIGHTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3950
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3951 /* 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
3952 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
3953 ReleaseCapture ();
23160
95a213639589 (w32_wnd_proc): Always zero button_state when releasing
Geoff Voelker <voelker@cs.washington.edu>
parents: 22625
diff changeset
3954 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
3955
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3956 /* 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
3957 TrackPopupMenu below, and should be ignored. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3958 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3959 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3960 f->output_data.w32->menubar_active = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3961
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3962 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
3963 0, hwnd, NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3964 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3965 MSG amsg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3966 /* Eat any mouse messages during popupmenu */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3967 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
3968 PM_REMOVE));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3969 /* Get the menu selection, if any */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3970 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
3971 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3972 retval = LOWORD (amsg.wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3973 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3974 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3975 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3976 retval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3977 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3978 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3979 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3980 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3981 retval = -1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3982 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3983
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3984 return retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3985 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3986
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3987 default:
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3988 /* Check for messages registered at runtime. */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3989 if (msg == msh_mousewheel)
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3990 {
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3991 wmsg.dwModifiers = w32_get_modifiers ();
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3992 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3993 return 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3994 }
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3995
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3996 dflt:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3997 return DefWindowProc (hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3998 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3999
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4000
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4001 /* 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
4002 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4003 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4004
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4005 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4006 my_create_window (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4007 struct frame * f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4008 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4009 MSG msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4010
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4011 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
4012 abort ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4013 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4014 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4015
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4016 /* Create and set up the w32 window for frame F. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4017
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4018 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4019 w32_window (f, window_prompting, minibuffer_only)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4020 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4021 long window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4022 int minibuffer_only;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4023 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4024 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4025
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4026 /* Use the resource name as the top-level window name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4027 for looking up resources. Make a non-Lisp copy
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4028 for the window manager, so GC relocation won't bother it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4029
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4030 Elsewhere we specify the window name for the window manager. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4031
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4032 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4033 char *str = (char *) XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4034 f->namebuf = (char *) xmalloc (strlen (str) + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4035 strcpy (f->namebuf, str);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4036 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4037
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4038 my_create_window (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4039
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4040 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4041
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4042 /* x_set_name normally ignores requests to set the name if the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4043 requested name is the same as the current name. This is the one
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4044 place where that assumption isn't correct; f->name is set, but
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4045 the server hasn't been told. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4046 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4047 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4048 int explicit = f->explicit_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4049
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4050 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4051 name = f->name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4052 f->name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4053 x_set_name (f, name, explicit);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4054 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4055
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4056 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4057
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4058 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4059 initialize_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4060
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4061 if (FRAME_W32_WINDOW (f) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4062 error ("Unable to create window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4063 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4064
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4065 /* Handle the icon stuff for this window. Perhaps later we might
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4066 want an x_set_icon_position which can be called interactively as
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4067 well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4068
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4069 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4070 x_icon (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4071 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4072 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4073 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4074 Lisp_Object icon_x, icon_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4075
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4076 /* Set the position of the icon. Note that Windows 95 groups all
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4077 icons in the tray. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4078 icon_x = x_get_arg (parms, Qicon_left, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4079 icon_y = x_get_arg (parms, Qicon_top, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4080 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4081 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4082 CHECK_NUMBER (icon_x, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4083 CHECK_NUMBER (icon_y, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4084 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4085 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4086 error ("Both left and top icon corners of icon must be specified");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4087
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4088 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4089
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4090 if (! EQ (icon_x, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4091 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4092
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4093 #if 0 /* TODO */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4094 /* Start up iconic or window? */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4095 x_wm_set_window_state
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4096 (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
4097 ? IconicState
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4098 : NormalState));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4099
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4100 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
4101 ? f->icon_name
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4102 : f->name))->data);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4103 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4104
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4105 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4106 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4107
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4108 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4109 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4110 "Make a new window, which is called a \"frame\" in Emacs terms.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4111 Returns an Emacs frame object.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4112 ALIST is an alist of frame parameters.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4113 If the parameters specify that the frame should not have a minibuffer,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4114 and do not specify a specific minibuffer window to use,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4115 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4116 be shared by the new frame.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4117 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4118 This function is an internal primitive--use `make-frame' instead.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4119 (parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4120 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4121 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4122 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4123 Lisp_Object frame, tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4124 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4125 int minibuffer_only = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4126 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4127 int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4128 int count = specpdl_ptr - specpdl;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4129 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4130 Lisp_Object display;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4131 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4132 Lisp_Object parent;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4133 struct kboard *kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4134
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4135 check_w32 ();
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4136
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4137 /* Use this general default value to start with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4138 until we know if this frame has a specified name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4139 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4140
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4141 display = x_get_arg (parms, Qdisplay, 0, 0, string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4142 if (EQ (display, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4143 display = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4144 dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4145 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4146 kb = dpyinfo->kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4147 #else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4148 kb = &the_only_kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4149 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4150
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4151 name = x_get_arg (parms, Qname, "name", "Name", string);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4152 if (!STRINGP (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4153 && ! EQ (name, Qunbound)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4154 && ! NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4155 error ("Invalid frame name--not a string or nil");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4156
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4157 if (STRINGP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4158 Vx_resource_name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4159
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4160 /* See if parent window is specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4161 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4162 if (EQ (parent, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4163 parent = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4164 if (! NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4165 CHECK_NUMBER (parent, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4166
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4167 /* 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
4168 /* 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
4169 it to make_frame_without_minibuffer. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4170 frame = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4171 GCPRO4 (parms, parent, name, frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4172 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4173 if (EQ (tem, Qnone) || NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4174 f = make_frame_without_minibuffer (Qnil, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4175 else if (EQ (tem, Qonly))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4176 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4177 f = make_minibuffer_frame ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4178 minibuffer_only = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4179 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4180 else if (WINDOWP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4181 f = make_frame_without_minibuffer (tem, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4182 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4183 f = make_frame (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4184
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4185 XSETFRAME (frame, f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4186
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4187 /* Note that Windows does support scroll bars. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4188 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
4189 /* 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
4190 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4191
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4192 f->output_method = output_w32;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4193 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
4194 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
4195
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4196 FRAME_FONTSET (f) = -1;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4197
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4198 f->icon_name
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4199 = 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
4200 if (! STRINGP (f->icon_name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4201 f->icon_name = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4202
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4203 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4204 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4205 FRAME_KBOARD (f) = kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4206 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4207
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4208 /* Specify the parent under which to make this window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4209
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4210 if (!NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4211 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4212 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
4213 f->output_data.w32->explicit_parent = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4214 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4215 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4216 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4217 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
4218 f->output_data.w32->explicit_parent = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4219 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4220
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4221 /* Note that the frame has no physical cursor right now. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4222 f->phys_cursor_x = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4223
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4224 /* Set the name; the functions to which we pass f expect the name to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4225 be set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4226 if (EQ (name, Qunbound) || NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4227 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4228 f->name = build_string (dpyinfo->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4229 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4230 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4231 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4232 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4233 f->name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4234 f->explicit_name = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4235 /* use the frame's title when getting resources for this frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4236 specbind (Qx_resource_name, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4237 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4238
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4239 /* 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
4240 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
4241 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
4242
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4243 /* Extract the window parameters from the supplied values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4244 that are needed to determine window geometry. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4245 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4246 Lisp_Object font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4247
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4248 font = x_get_arg (parms, Qfont, "font", "Font", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4249 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4250 /* First, try whatever font the caller has specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4251 if (STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4252 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4253 tem = Fquery_fontset (font, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4254 if (STRINGP (tem))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4255 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
4256 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4257 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
4258 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4259 /* Try out a font which we hope has bold and italic variations. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4260 if (!STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4261 font = x_new_font (f, "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4262 if (! STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4263 font = x_new_font (f, "-*-Courier-normal-r-*-*-*-97-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4264 /* If those didn't work, look for something which will at least work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4265 if (! STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4266 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-*-*-90-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4267 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4268 if (! STRINGP (font))
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4269 font = build_string ("Fixedsys");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4270
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4271 x_default_parameter (f, parms, Qfont, font,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4272 "font", "Font", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4273 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4274
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4275 x_default_parameter (f, parms, Qborder_width, make_number (2),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4276 "borderwidth", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4277 /* This defaults to 2 in order to match xterm. We recognize either
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4278 internalBorderWidth or internalBorder (which is what xterm calls
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4279 it). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4280 if (NILP (Fassq (Qinternal_border_width, parms)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4281 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4282 Lisp_Object value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4283
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4284 value = x_get_arg (parms, Qinternal_border_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4285 "internalBorder", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4286 if (! EQ (value, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4287 parms = Fcons (Fcons (Qinternal_border_width, value),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4288 parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4289 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4290 /* Default internalBorderWidth to 0 on Windows to match other programs. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4291 x_default_parameter (f, parms, Qinternal_border_width, make_number (0),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4292 "internalBorderWidth", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4293 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4294 "verticalScrollBars", "ScrollBars", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4295
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4296 /* Also do the stuff which must be set before the window exists. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4297 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4298 "foreground", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4299 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4300 "background", "Background", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4301 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4302 "pointerColor", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4303 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4304 "cursorColor", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4305 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4306 "borderColor", "BorderColor", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4307
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4308 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4309 "menuBar", "MenuBar", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4310 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4311 "scrollBarWidth", "ScrollBarWidth", number);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4312 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
4313 "bufferPredicate", "BufferPredicate", symbol);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4314 x_default_parameter (f, parms, Qtitle, Qnil,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4315 "title", "Title", string);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4316
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4317 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
4318 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4319 window_prompting = x_figure_window_size (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4320
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4321 if (window_prompting & XNegative)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4322 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4323 if (window_prompting & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4324 f->output_data.w32->win_gravity = SouthEastGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4325 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4326 f->output_data.w32->win_gravity = NorthEastGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4327 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4328 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4329 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4330 if (window_prompting & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4331 f->output_data.w32->win_gravity = SouthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4332 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4333 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4334 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4335
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4336 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
4337
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4338 w32_window (f, window_prompting, minibuffer_only);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4339 x_icon (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4340 init_frame_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4341
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4342 /* We need to do this after creating the window, so that the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4343 icon-creation functions can say whose icon they're describing. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4344 x_default_parameter (f, parms, Qicon_type, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4345 "bitmapIcon", "BitmapIcon", symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4346
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4347 x_default_parameter (f, parms, Qauto_raise, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4348 "autoRaise", "AutoRaiseLower", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4349 x_default_parameter (f, parms, Qauto_lower, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4350 "autoLower", "AutoRaiseLower", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4351 x_default_parameter (f, parms, Qcursor_type, Qbox,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4352 "cursorType", "CursorType", symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4353
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4354 /* Dimensions, especially f->height, must be done via change_frame_size.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4355 Change will not be effected unless different from the current
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4356 f->height. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4357 width = f->width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4358 height = f->height;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
4359 f->height = 0;
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
4360 SET_FRAME_WIDTH (f, 0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4361 change_frame_size (f, height, width, 1, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4362
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4363 /* Tell the server what size and position, etc, we want,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4364 and how badly we want them. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4365 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4366 x_wm_set_size_hint (f, window_prompting, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4367 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4368
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4369 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4370 f->no_split = minibuffer_only || EQ (tem, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4371
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4372 UNGCPRO;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4373
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4374 /* It is now ok to make the frame official
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4375 even if we get an error below.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4376 And the frame needs to be on Vframe_list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4377 or making it visible won't work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4378 Vframe_list = Fcons (frame, Vframe_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4379
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4380 /* Now that the frame is official, it counts as a reference to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4381 its display. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4382 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4383
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4384 /* Make the window appear on the frame and enable display,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4385 unless the caller says not to. However, with explicit parent,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4386 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
4387 if (! f->output_data.w32->explicit_parent)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4388 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4389 Lisp_Object visibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4391 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4392 if (EQ (visibility, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4393 visibility = Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4394
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4395 if (EQ (visibility, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4396 x_iconify_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4397 else if (! NILP (visibility))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4398 x_make_frame_visible (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4399 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4400 /* Must have been Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4401 ;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4402 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4403
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4404 return unbind_to (count, frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4405 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4406
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4407 /* FRAME is used only to get a handle on the X display. We don't pass the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4408 display info directly because we're called from frame.c, which doesn't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4409 know about that structure. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4410 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4411 x_get_focus_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4412 struct frame *frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4413 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4414 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4415 Lisp_Object xfocus;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4416 if (! dpyinfo->w32_focus_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4417 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4418
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4419 XSETFRAME (xfocus, dpyinfo->w32_focus_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4420 return xfocus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4421 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4422
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4423 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
4424 "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
4425 (frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4426 Lisp_Object frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4427 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4428 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
4429 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4430 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4431
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4432
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4433 /* Load font named FONTNAME of size SIZE for frame F, and return a
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4434 pointer to the structure font_info while allocating it dynamically.
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4435 If loading fails, return NULL. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4436 struct font_info *
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4437 w32_load_font (f,fontname,size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4438 struct frame *f;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4439 char * fontname;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4440 int size;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4441 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4442 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
4443 Lisp_Object font_names;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4444
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4445 #if 0 /* x_load_font attempts to get a list of fonts - presumably to
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4446 allow a fuzzier fontname to be specified. w32_list_fonts
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4447 appears to be a bit too fuzzy for this purpose. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4448
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4449 /* 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
4450 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
4451 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
4452 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
4453
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4454 if (!NILP (font_names))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4455 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4456 Lisp_Object tail;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4457 int i;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4458
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4459 #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
4460
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4461 /* 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
4462 than loading another one. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4463 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
4464 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
4465 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
4466 XSTRING (XCONS (tail)->car)->data)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4467 || !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
4468 XSTRING (XCONS (tail)->car)->data))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4469 return (dpyinfo->font_table + i);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4470 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4471
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4472 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
4473 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4474 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4475 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4476 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4477
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4478 /* 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
4479 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4480 char *full_name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4481 XFontStruct *font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4482 struct font_info *fontp;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4483 LOGFONT lf;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4484 BOOL ok;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4485
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4486 if (!fontname || !x_to_w32_font (fontname, &lf))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4487 return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4488
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4489 if (!*lf.lfFaceName)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4490 /* 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
4491 from CreateFontIndirect - this is not particularly
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4492 desirable, especially since CreateFontIndirect does not
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4493 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
4494 ended up with. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4495 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4496
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4497 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
4498
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4499 if (!font) return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4500
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4501 BLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4502
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4503 font->hfont = CreateFontIndirect (&lf);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4504
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4505 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
4506 {
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4507 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
4508 }
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4509 else
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4510 {
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4511 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
4512 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
4513
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4514 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
4515 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
4516 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
4517 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
4518 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
4519 }
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4520
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4521 UNBLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4522
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4523 if (!ok)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4524 {
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4525 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
4526 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
4527 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4528
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4529 /* 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
4530 if (dpyinfo->font_table_size == 0)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4531 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4532 dpyinfo->font_table_size = 16;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4533 dpyinfo->font_table
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4534 = (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
4535 * sizeof (struct font_info));
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4536 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4537 /* 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
4538 else if (dpyinfo->n_fonts
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4539 >= dpyinfo->font_table_size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4540 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4541 dpyinfo->font_table_size *= 2;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4542 dpyinfo->font_table
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4543 = (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
4544 (dpyinfo->font_table_size
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4545 * sizeof (struct font_info)));
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4546 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4547
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4548 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
4549
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4550 /* 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
4551 BLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4552 fontp->font = font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4553 fontp->font_idx = dpyinfo->n_fonts;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4554 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
4555 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
4556
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4557 /* 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
4558 full_name = (char *)xmalloc (100);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4559 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
4560 fontp->full_name = full_name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4561 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4562 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4563 /* 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
4564 xfree (full_name);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4565 fontp->full_name = fontp->name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4566 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4567
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4568 fontp->size = FONT_WIDTH (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4569 fontp->height = FONT_HEIGHT (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4570
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4571 /* 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
4572 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
4573 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
4574 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
4575 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
4576 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
4577 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
4578 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
4579 decided, set FONT_ENCODING_NOT_DECIDED. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4580 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
4581
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4582 /* 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
4583 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
4584 fontp->baseline_offset = 0;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4585 fontp->relative_compose = 0;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4586 fontp->default_ascent = FONT_BASE (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4587
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4588 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4589 dpyinfo->n_fonts++;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4590
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4591 return fontp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4592 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4593 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4594
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4595 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4596 w32_unload_font (dpyinfo, font)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4597 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4598 XFontStruct * font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4599 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4600 if (font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4601 {
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4602 if (font->hfont) DeleteObject(font->hfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4603 xfree (font);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4604 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4605 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4606
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4607 /* The font conversion stuff between x and w32 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4608
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4609 /* X font string is as follows (from faces.el)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4610 * (let ((- "[-?]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4611 * (foundry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4612 * (family "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4613 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4614 * (weight\? "\\([^-]*\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4615 * (slant "\\([ior]\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4616 * (slant\? "\\([^-]?\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4617 * (swidth "\\([^-]*\\)") ; 3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4618 * (adstyle "[^-]*") ; 4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4619 * (pixelsize "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4620 * (pointsize "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4621 * (resx "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4622 * (resy "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4623 * (spacing "[cmp?*]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4624 * (avgwidth "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4625 * (registry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4626 * (encoding "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4627 * )
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4628 * (setq x-font-regexp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4629 * (concat "\\`\\*?[-?*]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4630 * foundry - family - weight\? - slant\? - swidth - adstyle -
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4631 * pixelsize - pointsize - resx - resy - spacing - registry -
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4632 * encoding "[-?*]\\*?\\'"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4633 * ))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4634 * (setq x-font-regexp-head
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4635 * (concat "\\`[-?*]" foundry - family - weight\? - slant\?
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4636 * "\\([-*?]\\|\\'\\)"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4637 * (setq x-font-regexp-slant (concat - slant -))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4638 * (setq x-font-regexp-weight (concat - weight -))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4639 * nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4640 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4641
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4642 #define FONT_START "[-?]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4643 #define FONT_FOUNDRY "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4644 #define FONT_FAMILY "\\([^-]+\\)" /* 1 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4645 #define FONT_WEIGHT "\\(bold\\|demibold\\|medium\\)" /* 2 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4646 #define FONT_WEIGHT_Q "\\([^-]*\\)" /* 2 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4647 #define FONT_SLANT "\\([ior]\\)" /* 3 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4648 #define FONT_SLANT_Q "\\([^-]?\\)" /* 3 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4649 #define FONT_SWIDTH "\\([^-]*\\)" /* 4 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4650 #define FONT_ADSTYLE "[^-]*"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4651 #define FONT_PIXELSIZE "[^-]*"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4652 #define FONT_POINTSIZE "\\([0-9][0-9]+\\|\\*\\)" /* 5 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4653 #define FONT_RESX "[0-9][0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4654 #define FONT_RESY "[0-9][0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4655 #define FONT_SPACING "[cmp?*]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4656 #define FONT_AVGWIDTH "[0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4657 #define FONT_REGISTRY "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4658 #define FONT_ENCODING "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4659
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4660 #define FONT_REGEXP ("\\`\\*?[-?*]" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4661 FONT_FOUNDRY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4662 FONT_FAMILY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4663 FONT_WEIGHT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4664 FONT_SLANT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4665 FONT_SWIDTH "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4666 FONT_ADSTYLE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4667 FONT_PIXELSIZE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4668 FONT_POINTSIZE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4669 "[-?*]\\|\\'")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4670
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4671 #define FONT_REGEXP_HEAD ("\\`[-?*]" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4672 FONT_FOUNDRY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4673 FONT_FAMILY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4674 FONT_WEIGHT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4675 FONT_SLANT_Q \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4676 "\\([-*?]\\|\\'\\)")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4677
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4678 #define FONT_REGEXP_SLANT "-" FONT_SLANT "-"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4679 #define FONT_REGEXP_WEIGHT "-" FONT_WEIGHT "-"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4680
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4681 LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4682 x_to_w32_weight (lpw)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4683 char * lpw;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4684 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4685 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
4686
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4687 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
4688 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
4689 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
4690 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
4691 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
4692 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
4693 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
4694 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
4695 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
4696 else if (stricmp (lpw,"thin") == 0) return FW_THIN;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4697 else
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4698 return FW_DONTCARE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4699 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4700
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4701
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4702 char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4703 w32_to_x_weight (fnweight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4704 int fnweight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4705 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4706 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
4707 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
4708 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
4709 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
4710 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
4711 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
4712 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
4713 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
4714 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
4715 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4716 return "*";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4717 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4718
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4719 LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4720 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
4721 char * lpcs;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4722 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4723 if (!lpcs) return (0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4724
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4725 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
4726 else if (stricmp (lpcs,"iso8859-1") == 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
4727 else if (stricmp (lpcs, "symbol") == 0) return SYMBOL_CHARSET;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4728 else if (stricmp (lpcs, "jis") == 0) return SHIFTJIS_CHARSET;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4729 else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4730 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
4731 else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_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
4732 else if (stricmp (lpcs, "oem") == 0) return OEM_CHARSET;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4733
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4734 #ifdef EASTEUROPE_CHARSET
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4735 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
4736 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
4737 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
4738 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
4739 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
4740 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
4741 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
4742 else if (stricmp (lpcs, "iso8859-8") == 0) return HEBREW_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4743 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
4744 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
4745 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
4746 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4747 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4748
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4749 #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
4750 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
4751 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
4752 #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
4753 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
4754 else
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4755 return DEFAULT_CHARSET;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4756 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4757
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4758 char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4759 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
4760 int fncharset;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4761 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4762 static char buf[16];
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4763
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4764 switch (fncharset)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4765 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4766 /* 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
4767 case ANSI_CHARSET: return "iso8859-1";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4768 case DEFAULT_CHARSET: return "ascii-*";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4769 case SYMBOL_CHARSET: return "*-symbol";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4770 case SHIFTJIS_CHARSET: return "jisx0212-sjis";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4771 case HANGEUL_CHARSET: return "ksc5601-*";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4772 case GB2312_CHARSET: return "gb2312-*";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4773 case CHINESEBIG5_CHARSET: return "big5-*";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4774 case OEM_CHARSET: return "*-oem";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4775
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4776 /* 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
4777 character sets. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4778 #ifdef EASTEUROPE_CHARSET
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4779 case EASTEUROPE_CHARSET: return "iso8859-2";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4780 case TURKISH_CHARSET: return "iso8859-3";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4781 case BALTIC_CHARSET: return "iso8859-4";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4782 case RUSSIAN_CHARSET: return "iso8859-5";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4783 case ARABIC_CHARSET: return "iso8859-6";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4784 case GREEK_CHARSET: return "iso8859-7";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4785 case HEBREW_CHARSET: return "iso8859-8";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4786 case VIETNAMESE_CHARSET: return "viscii1.1-*";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4787 case THAI_CHARSET: return "tis620-*";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4788 case MAC_CHARSET: return "*-mac";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4789 case JOHAB_CHARSET: break; /* What is this? Latin-9? */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4790 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4791
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4792 #ifdef UNICODE_CHARSET
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4793 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
4794 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4795 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4796 /* 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
4797 sprintf (buf, "*-#%u", fncharset);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4798 return buf;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4799 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4800
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4801 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4802 w32_to_x_font (lplogfont, lpxstr, len)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4803 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4804 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4805 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4806 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4807 char fontname[50];
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4808 char height_pixels[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4809 char height_dpi[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4810 char width_pixels[8];
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4811 char *fontname_dash;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4812
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4813 if (!lpxstr) abort ();
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4814
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4815 if (!lplogfont)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4816 return FALSE;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4817
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4818 strncpy (fontname, lplogfont->lfFaceName, 50);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4819 fontname[49] = '\0'; /* Just in case */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4820
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4821 /* 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
4822 misinterpreted */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4823 fontname_dash = fontname;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4824 while (fontname_dash = strchr (fontname_dash, '-'))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4825 *fontname_dash = '_';
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4826
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4827 if (lplogfont->lfHeight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4828 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4829 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight));
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4830 sprintf (height_dpi, "%u",
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4831 (abs (lplogfont->lfHeight) * 720) / one_w32_display_info.height_in);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4832 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4833 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4834 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4835 strcpy (height_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4836 strcpy (height_dpi, "*");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4837 }
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4838 if (lplogfont->lfWidth)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4839 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10);
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4840 else
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4841 strcpy (width_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4842
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4843 _snprintf (lpxstr, len - 1,
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4844 "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-%s",
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4845 /* foundry */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4846 fontname, /* family */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4847 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
4848 lplogfont->lfItalic?'i':'r', /* slant */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4849 /* setwidth name */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4850 /* add style name */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4851 height_pixels, /* pixel size */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4852 height_dpi, /* point size */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4853 /* resx */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4854 /* resy */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4855 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4856 ? 'p' : 'c', /* spacing */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4857 width_pixels, /* avg width */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4858 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
4859 and encoding*/
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4860 );
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4861
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4862 lpxstr[len - 1] = 0; /* just to be sure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4863 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4864 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4865
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4866 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4867 x_to_w32_font (lpxstr, lplogfont)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4868 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4869 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4870 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4871 if (!lplogfont) return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4872
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4873 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
4874
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4875 /* 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
4876 #if 1
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4877 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4878 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4879 lplogfont->lfQuality = DEFAULT_QUALITY;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4880 #else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4881 /* go for maximum quality */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4882 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4883 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4884 lplogfont->lfQuality = PROOF_QUALITY;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4885 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4886
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4887 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
4888 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
4889 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
4890
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4891 if (!lpxstr)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4892 return FALSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4893
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4894 /* 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
4895 * 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
4896 * format:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4897 * "<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
4898 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4899
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4900 if (*lpxstr == '-')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4901 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4902 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4903 char name[50], weight[20], slant, pitch, pixels[10], height[10], width[10], remainder[20];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4904 char * encoding;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4905
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4906 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4907 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%*[^-]-%c-%9[^-]-%19s",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4908 name, weight, &slant, pixels, height, &pitch, width, remainder);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4909
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4910 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4911
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4912 if (fields > 0 && name[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4913 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4914 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
4915 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
4916 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4917 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4918 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4919 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4920 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4921
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4922 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4923
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4924 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
4925
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4926 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4927
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4928 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
4929 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
4930
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4931 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4932
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4933 if (fields > 0 && pixels[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4934 lplogfont->lfHeight = atoi (pixels);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4935
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4936 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4937
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4938 if (fields > 0 && lplogfont->lfHeight == 0 && height[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4939 lplogfont->lfHeight = (atoi (height)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4940 * one_w32_display_info.height_in) / 720;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4941
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4942 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4943
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4944 lplogfont->lfPitchAndFamily =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4945 (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
4946
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4947 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4948
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4949 if (fields > 0 && width[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4950 lplogfont->lfWidth = atoi (width) / 10;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4951
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4952 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4953
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4954 /* 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
4955 fails the test against xlfn-tight-regexp in fontset.el). */
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4956 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4957 int len = strlen (remainder);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4958 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
4959 remainder[len-1] = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4960 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4961 encoding = remainder;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4962 if (strncmp (encoding, "*-", 2) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4963 encoding += 2;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4964 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
4965 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4966 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4967 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4968 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4969 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
4970
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4971 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4972 "%99[^:]:%9[^:]:%9[^:]:%19s",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4973 name, height, width, weight);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4974
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4975 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4976
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4977 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4978 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4979 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
4980 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
4981 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4982 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4983 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4984 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4985 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4986
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4987 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4988
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4989 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4990 lplogfont->lfHeight = atoi (height);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4991
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4992 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4993
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4994 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4995 lplogfont->lfWidth = atoi (width);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4996
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4997 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4998
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4999 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
5000 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5001
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5002 /* 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
5003 lplogfont->lfHeight = - abs (lplogfont->lfHeight);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5004
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5005 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5006 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5007
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5008 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5009 w32_font_match (lpszfont1, lpszfont2)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5010 char * lpszfont1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5011 char * lpszfont2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5012 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5013 char * s1 = lpszfont1, *e1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5014 char * s2 = lpszfont2, *e2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5015
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5016 if (s1 == NULL || s2 == NULL) return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5017
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5018 if (*s1 == '-') s1++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5019 if (*s2 == '-') s2++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5020
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5021 while (1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5022 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5023 int len1, len2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5024
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5025 e1 = strchr (s1, '-');
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5026 e2 = strchr (s2, '-');
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5027
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5028 if (e1 == NULL || e2 == NULL) return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5029
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5030 len1 = e1 - s1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5031 len2 = e2 - s2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5032
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5033 if (*s1 != '*' && *s2 != '*'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5034 && (len1 != len2 || strnicmp (s1, s2, len1) != 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5035 return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5036
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5037 s1 = e1 + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5038 s2 = e2 + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5039 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5040 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5041
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5042 typedef struct enumfont_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5043 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5044 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5045 int numFonts;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5046 LOGFONT logfont;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5047 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5048 Lisp_Object *pattern;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5049 Lisp_Object *head;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5050 Lisp_Object *tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5051 } enumfont_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5052
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5053 int CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5054 enum_font_cb2 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5055 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5056 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5057 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5058 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5059 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5060 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5061 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5062
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5063 /* 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
5064 if (lpef->logfont.lfCharSet != DEFAULT_CHARSET &&
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5065 lplf->elfLogFont.lfCharSet != lpef->logfont.lfCharSet)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5066 return (1);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5067
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5068 /* We want all fonts cached, so don't compare sizes just yet */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5069 /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5070 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5071 char buf[100];
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5072 Lisp_Object width = Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5073
21896
ff66bfc5d801 (enum_font_cb2): Only ignore raster fonts when
Geoff Voelker <voelker@cs.washington.edu>
parents: 21884
diff changeset
5074 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
5075 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5076 /* 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
5077 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5078 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5079 }
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5080
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5081 /* 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
5082 if (FontType == RASTER_FONTTYPE)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5083 width = make_number (lptm->tmMaxCharWidth);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5084
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5085 if (!w32_to_x_font (lplf, buf, 100)) return (0);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5086
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5087 if (NILP (*(lpef->pattern)) || w32_font_match (buf, XSTRING (*(lpef->pattern))->data))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5088 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5089 *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
5090 lpef->tail = &(XCONS (*lpef->tail)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5091 lpef->numFonts++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5092 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5093 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5094
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5095 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5096 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5097
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5098 int CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5099 enum_font_cb1 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5100 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5101 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5102 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5103 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5104 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5105 return EnumFontFamilies (lpef->hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5106 lplf->elfLogFont.lfFaceName,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5107 (FONTENUMPROC) enum_font_cb2,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5108 (LPARAM) lpef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5109 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5110
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5111
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5112 /* 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
5113 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
5114
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5115 /* 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
5116 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
5117 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
5118 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
5119 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
5120 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
5121
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5122 Lisp_Object
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5123 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
5124 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5125 Lisp_Object patterns, key, tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5126 Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5127
23637
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5128 /* If we don't have a frame, we can't use the Windows API to list
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5129 fonts, as it requires a device context for the Window. This will
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5130 only happen during startup if the user specifies a font on the
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5131 command line. Print a message on stderr and return nil. */
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5132 if (!f)
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5133 {
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5134 char buffer[256];
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5135
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5136 sprintf (buffer,
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5137 "Emacs cannot get a list of fonts before the initial frame "
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5138 "is created.\nThe font specified on the command line may not "
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5139 "be found.\n");
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5140 MessageBox (NULL, buffer, "Emacs Warning Dialog",
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5141 MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL);
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5142 return Qnil;
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5143 }
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5144
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
5145
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5146 patterns = Fassoc (pattern, Valternate_fontname_alist);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5147 if (NILP (patterns))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5148 patterns = Fcons (pattern, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5149
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5150 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
5151 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5152 enumfont_t ef;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5153
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5154 pattern = XCONS (patterns)->car;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5155
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5156 /* 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
5157 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
5158 ((PATTERN (FONTNAME . WIDTH) ...) ...)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5159 */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5160 if ( f &&
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5161 (tem = XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5162 !NILP (list = Fassoc (pattern, tem))))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5163 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5164 list = Fcdr_safe (list);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5165 /* 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
5166 goto label_cached;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5167 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5168
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5169 BLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5170 /* 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
5171 list = Qnil;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5172 ef.pattern = &pattern;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5173 ef.tail = ef.head = &list;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5174 ef.numFonts = 0;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5175 x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data :
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5176 NULL, &ef.logfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5177 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5178 ef.hdc = GetDC (FRAME_W32_WINDOW (f));
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5179
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5180 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5181 (LPARAM)&ef);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5182
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5183 ReleaseDC (FRAME_W32_WINDOW (f), ef.hdc);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5184 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5185
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5186 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5187
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5188 /* 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
5189 Store that in the font cache for the display. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5190 if (f != NULL)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5191 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5192 = Fcons (Fcons (pattern, list),
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5193 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5194
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5195 label_cached:
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5196 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
5197
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5198 newlist = second_best = Qnil;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5199
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5200 /* 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
5201 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
5202 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5203 int found_size;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5204 tem = XCONS (list)->car;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5205
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5206 if (!CONSP (tem))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5207 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5208 if (NILP (XCONS (tem)->car))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5209 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5210 if (!size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5211 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5212 newlist = Fcons (XCONS (tem)->car, newlist);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5213 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5214 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5215 if (!INTEGERP (XCONS (tem)->cdr))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5216 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5217 /* 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
5218 load it and try GetTextMetrics. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5219 struct w32_display_info *dpyinfo
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5220 = FRAME_W32_DISPLAY_INFO (f);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5221 W32FontStruct thisinfo;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5222 LOGFONT lf;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5223 HDC hdc;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5224 HANDLE oldobj;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5225
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5226 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
5227 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5228
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5229 BLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5230 thisinfo.hfont = CreateFontIndirect (&lf);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5231 if (thisinfo.hfont == NULL)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5232 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5233
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5234 hdc = GetDC (dpyinfo->root_window);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5235 oldobj = SelectObject (hdc, thisinfo.hfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5236 if (GetTextMetrics (hdc, &thisinfo.tm))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5237 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
5238 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5239 XCONS (tem)->cdr = make_number (0);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5240 SelectObject (hdc, oldobj);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5241 ReleaseDC (dpyinfo->root_window, hdc);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5242 DeleteObject(thisinfo.hfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5243 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5244 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5245 found_size = XINT (XCONS (tem)->cdr);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5246 if (found_size == size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5247 newlist = Fcons (XCONS (tem)->car, newlist);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5248
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5249 /* 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
5250 no exact match is found. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5251 else if (found_size > 0)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5252 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5253 if (NILP (second_best))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5254 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5255 else if (found_size < size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5256 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5257 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
5258 || 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
5259 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5260 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5261 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5262 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5263 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
5264 && XINT (XCONS (second_best)->cdr) >
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5265 found_size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5266 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5267 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5268 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5269 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5270
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5271 if (!NILP (newlist))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5272 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5273 else if (!NILP (second_best))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5274 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5275 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
5276 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5277 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5278 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5279
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5280 return newlist;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5281 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5282
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5283 /* 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
5284 struct font_info *
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5285 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
5286 FRAME_PTR f;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5287 int font_idx;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5288 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5289 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
5290 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5291
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5292
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5293 struct font_info*
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5294 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
5295 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5296 int i;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5297 struct font_info *pfi;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5298
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5299 pfi = FRAME_W32_FONT_TABLE (f);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5300
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5301 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
5302 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5303 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
5304 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5305
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5306 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5307 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5308
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5309 /* 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
5310 `encoder' of the structure. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5311
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5312 void
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5313 w32_find_ccl_program (fontp)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5314 struct font_info *fontp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5315 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5316 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
5317 extern Lisp_Object Qccl_program_idx;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5318 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
5319 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
5320
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5321 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
5322 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5323 elt = XCONS (list)->car;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5324 if (CONSP (elt)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5325 && STRINGP (XCONS (elt)->car)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5326 && (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
5327 >= 0))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5328 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5329 if (SYMBOLP (XCONS (elt)->cdr) &&
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5330 (!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
5331 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5332 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
5333 if (!CONSP (ccl_prog)) continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5334 ccl_prog = XCONS (ccl_prog)->cdr;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5335 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5336 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5337 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5338 ccl_prog = XCONS (elt)->cdr;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5339 if (!VECTORP (ccl_prog)) continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5340 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5341
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5342 fontp->font_encoder
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5343 = (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
5344 setup_ccl_program (fontp->font_encoder,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5345 resolve_symbol_ccl_program (ccl_prog));
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5346 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5347 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5348 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5349 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5350
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5351
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5352 #if 1
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5353 #include "x-list-font.c"
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5354 #else
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
5355 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 4, 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5356 "Return a list of the names of available fonts matching PATTERN.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5357 If optional arguments FACE and FRAME are specified, return only fonts\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5358 the same size as FACE on FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5359 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5360 PATTERN is a string, perhaps with wildcard characters;\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5361 the * character matches any substring, and\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5362 the ? character matches any single character.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5363 PATTERN is case-insensitive.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5364 FACE is a face name--a symbol.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5365 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5366 The return value is a list of strings, suitable as arguments to\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5367 set-face-font.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5368 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5369 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
5370 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
5371 \n\
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
5372 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
5373 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
5374 (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
5375 Lisp_Object pattern, face, frame, maximum;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5376 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5377 int num_fonts;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5378 char **names;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5379 XFontStruct *info;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5380 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5381 Lisp_Object namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5382 Lisp_Object list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5383 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5384 enumfont_t ef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5385
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5386 CHECK_STRING (pattern, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5387 if (!NILP (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5388 CHECK_SYMBOL (face, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5389
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5390 f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5391
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5392 /* Determine the width standard for comparison with the fonts we find. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5393
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5394 if (NILP (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5395 size_ref = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5396 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5397 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5398 int face_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5399
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5400 /* 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
5401 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5402 error ("non-w32 frame used in `x-list-fonts'");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5403
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5404 face_id = face_name_id_number (f, face);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5405
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5406 if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5407 || 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
5408 size_ref = f->output_data.w32->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5409 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5410 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5411 size_ref = FRAME_PARAM_FACES (f) [face_id]->font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5412 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
5413 size_ref = f->output_data.w32->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5414 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5415 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5416
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5417 /* See if we cached the result for this particular query. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5418 list = Fassoc (pattern,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5419 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5420
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5421 /* We have info in the cache for this PATTERN. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5422 if (!NILP (list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5423 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5424 Lisp_Object tem, newlist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5425
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5426 /* We have info about this pattern. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5427 list = XCONS (list)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5428
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5429 if (size_ref == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5430 return list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5431
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5432 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5433
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5434 /* Filter the cached info and return just the fonts that match FACE. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5435 newlist = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5436 for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5437 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5438 struct font_info *fontinf;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5439 XFontStruct *thisinfo = NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5440
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5441 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
5442 if (fontinf)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5443 thisinfo = (XFontStruct *)fontinf->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5444 if (thisinfo && same_size_fonts (thisinfo, size_ref))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5445 newlist = Fcons (XCONS (tem)->car, newlist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5446
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5447 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5448 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5449
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5450 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5451
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5452 return newlist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5453 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5454
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5455 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5456
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5457 namelist = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5458 ef.pattern = &pattern;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5459 ef.tail = ef.head = &namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5460 ef.numFonts = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5461 x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5462
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5463 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5464 ef.hdc = GetDC (FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5465
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5466 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, (LPARAM)&ef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5467
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5468 ReleaseDC (FRAME_W32_WINDOW (f), ef.hdc);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5469 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5470
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5471 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5472
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5473 if (ef.numFonts)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5474 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5475 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5476 Lisp_Object cur;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5477
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5478 /* Make a list of all the fonts we got back.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5479 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
5480 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5481 = Fcons (Fcons (pattern, namelist),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5482 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5483
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5484 /* Make a list of the fonts that have the right width. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5485 list = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5486 cur=namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5487 for (i = 0; i < ef.numFonts; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5488 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5489 int keeper;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5490
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5491 if (!size_ref)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5492 keeper = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5493 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5494 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5495 struct font_info *fontinf;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5496 XFontStruct *thisinfo = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5497
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5498 BLOCK_INPUT;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5499 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
5500 if (fontinf)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5501 thisinfo = (XFontStruct *)fontinf->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5502
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5503 keeper = thisinfo && same_size_fonts (thisinfo, size_ref);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5504
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5505 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5506
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5507 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5508 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5509 if (keeper)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5510 list = Fcons (build_string (XSTRING (Fcar (cur))->data), list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5511
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5512 cur = Fcdr (cur);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5513 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5514 list = Fnreverse (list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5515 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5516
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5517 return list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5518 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5519 #endif
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5520
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5521 DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5522 "Return non-nil if color COLOR is supported on frame FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5523 If FRAME is omitted or nil, use the selected frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5524 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5525 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5526 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5527 COLORREF foo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5528 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5529
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5530 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5531
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5532 if (defined_color (f, XSTRING (color)->data, &foo, 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5533 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5534 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5535 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5536 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5537
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5538 DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5539 "Return a description of the color named COLOR on frame FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5540 The value is a list of integer RGB values--(RED GREEN BLUE).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5541 These values appear to range from 0 to 65280 or 65535, depending\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5542 on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5543 If FRAME is omitted or nil, use the selected frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5544 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5545 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5546 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5547 COLORREF foo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5548 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5549
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5550 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5551
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5552 if (defined_color (f, XSTRING (color)->data, &foo, 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5553 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5554 Lisp_Object rgb[3];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5555
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5556 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
5557 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
5558 rgb[2] = make_number ((GetBValue (foo) << 8) | GetBValue (foo));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5559 return Flist (3, rgb);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5560 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5561 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5562 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5563 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5564
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5565 DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5566 "Return t if the X display supports color.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5567 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5568 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5569 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5570 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5571 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5572 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5573 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5574
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5575 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5576 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5577
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5578 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5579 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5580
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5581 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5582 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5583 "Return t if the X display supports shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5584 Note that color displays do support shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5585 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5586 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5587 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5588 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5589 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5590 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5591 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5592
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5593 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5594 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5595
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5596 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5597 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5598
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5599 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5600 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5601 "Returns the width in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5602 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5603 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5604 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5605 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5606 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5607 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5608 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5609
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5610 return make_number (dpyinfo->width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5611 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5612
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5613 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5614 Sx_display_pixel_height, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5615 "Returns the height in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5616 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5617 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5618 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5619 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5620 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5621 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5622 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5623
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5624 return make_number (dpyinfo->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5625 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5626
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5627 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5628 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5629 "Returns the number of bitplanes of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5630 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5631 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5632 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5633 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5634 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5635 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5636 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5637
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5638 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5639 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5640
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5641 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5642 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5643 "Returns the number of color cells of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5644 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5645 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5646 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5647 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5648 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5649 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5650 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5651 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5652 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5653
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5654 hdc = GetDC (dpyinfo->root_window);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5655 if (dpyinfo->has_palette)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5656 cap = GetDeviceCaps (hdc,SIZEPALETTE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5657 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5658 cap = GetDeviceCaps (hdc,NUMCOLORS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5659
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5660 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5661
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5662 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5663 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5664
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5665 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5666 Sx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5667 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5668 "Returns the maximum request size of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5669 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5670 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5671 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5672 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5673 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5674 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5675 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5676
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5677 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5678 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5679
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5680 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
5681 "Returns the vendor ID string of the W32 system (Microsoft).\n\
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5682 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5683 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5684 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5685 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5686 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5687 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5688 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5689 char *vendor = "Microsoft Corp.";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5690
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5691 if (! vendor) vendor = "";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5692 return build_string (vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5693 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5694
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5695 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5696 "Returns the version numbers of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5697 The value is a list of three integers: the major and minor\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5698 version numbers, and the vendor-specific release\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5699 number. See also the function `x-server-vendor'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5700 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5701 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5702 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5703 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5704 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5705 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5706 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
5707
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5708 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
5709 Fcons (make_number (w32_minor_version), Qnil));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5710 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5711
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5712 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5713 "Returns the number of screens on the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5714 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5715 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5716 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5717 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5718 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5719 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5720 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5721
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5722 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5723 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5724
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5725 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5726 "Returns the height in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5727 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5728 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5729 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5730 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5731 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5732 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5733 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5734 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5735 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5736
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5737 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5738
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5739 cap = GetDeviceCaps (hdc, VERTSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5740
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5741 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5742
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5743 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5744 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5745
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5746 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5747 "Returns the width in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5748 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5749 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5750 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5751 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5752 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5753 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5754 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5755
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5756 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5757 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5758
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5759 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5760
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5761 cap = GetDeviceCaps (hdc, HORZSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5762
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5763 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5764
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5765 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5766 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5767
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5768 DEFUN ("x-display-backing-store", Fx_display_backing_store,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5769 Sx_display_backing_store, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5770 "Returns an indication of whether display DISPLAY does backing store.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5771 The value may be `always', `when-mapped', or `not-useful'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5772 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5773 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5774 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5775 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5776 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5777 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5778 return intern ("not-useful");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5779 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5780
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5781 DEFUN ("x-display-visual-class", Fx_display_visual_class,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5782 Sx_display_visual_class, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5783 "Returns the visual class of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5784 The value is one of the symbols `static-gray', `gray-scale',\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5785 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5786 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5787 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5788 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5789 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5790 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5791 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5792 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5793
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5794 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5795 switch (dpyinfo->visual->class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5796 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5797 case StaticGray: return (intern ("static-gray"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5798 case GrayScale: return (intern ("gray-scale"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5799 case StaticColor: return (intern ("static-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5800 case PseudoColor: return (intern ("pseudo-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5801 case TrueColor: return (intern ("true-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5802 case DirectColor: return (intern ("direct-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5803 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5804 error ("Display has an unknown visual class");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5805 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5806 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5807
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5808 error ("Display has an unknown visual class");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5809 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5810
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5811 DEFUN ("x-display-save-under", Fx_display_save_under,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5812 Sx_display_save_under, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5813 "Returns t if the display DISPLAY supports the save-under feature.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5814 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5815 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5816 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5817 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5818 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5819 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5820 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5821
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5822 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5823 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5824
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5825 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5826 x_pixel_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5827 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5828 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5829 return PIXEL_WIDTH (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5830 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5831
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5832 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5833 x_pixel_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5834 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5835 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5836 return PIXEL_HEIGHT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5837 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5838
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5839 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5840 x_char_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5841 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5842 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5843 return FONT_WIDTH (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5844 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5845
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5846 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5847 x_char_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5848 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5849 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5850 return f->output_data.w32->line_height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5851 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5852
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5853 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5854 x_screen_planes (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5855 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5856 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5857 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
5858 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5859 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5860
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5861 /* Return the display structure for the display named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5862 Open a new connection if necessary. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5863
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5864 struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5865 x_display_info_for_name (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5866 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5867 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5868 Lisp_Object names;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5869 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5870
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5871 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5872
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5873 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5874 dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5875 dpyinfo = dpyinfo->next, names = XCONS (names)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5876 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5877 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5878 tem = Fstring_equal (XCONS (XCONS (names)->car)->car, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5879 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5880 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5881 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5882
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5883 /* Use this general default value to start with. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5884 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5885
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5886 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5887
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5888 dpyinfo = w32_term_init (name, (unsigned char *)0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5889 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5890
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5891 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5892 error ("Cannot connect to server %s", XSTRING (name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5893
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5894 w32_in_use = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5895 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5896
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5897 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5898 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5899
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5900 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5901 1, 3, 0, "Open a connection to a server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5902 DISPLAY is the name of the display to connect to.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5903 Optional second arg XRM-STRING is a string of resources in xrdb format.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5904 If the optional third arg MUST-SUCCEED is non-nil,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5905 terminate Emacs if we can't open the connection.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5906 (display, xrm_string, must_succeed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5907 Lisp_Object display, xrm_string, must_succeed;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5908 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5909 unsigned int n_planes;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5910 unsigned char *xrm_option;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5911 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5912
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5913 CHECK_STRING (display, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5914 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5915 CHECK_STRING (xrm_string, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5916
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5917 if (! EQ (Vwindow_system, intern ("w32")))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5918 error ("Not using Microsoft Windows");
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5919
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5920 /* 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
5921 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
5922 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5923 Lisp_Object color_file;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5924 struct gcpro gcpro1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5925
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5926 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
5927
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5928 GCPRO1 (color_file);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5929
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5930 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
5931 color_file =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5932 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
5933 Fsymbol_value (intern ("data-directory")));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5934
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5935 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
5936
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5937 UNGCPRO;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5938 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5939 if (NILP (Vw32_color_map))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5940 Vw32_color_map = Fw32_default_color_map ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5941
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5942 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5943 xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5944 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5945 xrm_option = (unsigned char *) 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5946
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5947 /* 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
5948 /* 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
5949 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5950 char basename[ MAX_PATH ], *str;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5951
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5952 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
5953 str = strrchr (basename, '.');
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5954 if (str) *str = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5955 Vinvocation_name = build_string (basename);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5956 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5957 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5958
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5959 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5960
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5961 /* This is what opens the connection and sets x_current_display.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5962 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
5963 dpyinfo = w32_term_init (display, xrm_option,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5964 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5965
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5966 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5967 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5968 if (!NILP (must_succeed))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5969 fatal ("Cannot connect to server %s.\n",
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5970 XSTRING (display)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5971 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5972 error ("Cannot connect to server %s", XSTRING (display)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5973 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5974
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5975 w32_in_use = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5976
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5977 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5978 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5979 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5980
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5981 DEFUN ("x-close-connection", Fx_close_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5982 Sx_close_connection, 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5983 "Close the connection to DISPLAY's server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5984 For DISPLAY, specify either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5985 If DISPLAY is nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5986 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5987 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5988 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5989 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
5990 struct w32_display_info *tail;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5991 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5992
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5993 if (dpyinfo->reference_count > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5994 error ("Display still has frames on it");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5995
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5996 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5997 /* Free the fonts in the font table. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5998 for (i = 0; i < dpyinfo->n_fonts; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5999 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6000 if (dpyinfo->font_table[i].name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6001 free (dpyinfo->font_table[i].name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6002 /* Don't free the full_name string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6003 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
6004 w32_unload_font (dpyinfo, dpyinfo->font_table[i].font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6005 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6006 x_destroy_all_bitmaps (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6007
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6008 x_delete_display (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6009 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6010
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6011 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6012 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6013
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6014 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6015 "Return the list of display names that Emacs has connections to.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6016 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6017 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6018 Lisp_Object tail, result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6019
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6020 result = Qnil;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6021 for (tail = w32_display_name_list; ! NILP (tail); tail = XCONS (tail)->cdr)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6022 result = Fcons (XCONS (XCONS (tail)->car)->car, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6023
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6024 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6025 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6026
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6027 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6028 "If ON is non-nil, report errors as soon as the erring request is made.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6029 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
6030 This is a noop on W32 systems.\n\
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6031 The optional second argument DISPLAY specifies which display to act on.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6032 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6033 If DISPLAY is omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6034 (on, display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6035 Lisp_Object display, on;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6036 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6037 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6038
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6039 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6040 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6041
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6042
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6043 /* 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
6044
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6045 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
6046 "This will display the W32 font dialog and return an X font string corresponding to the selection.")
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6047 (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6048 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6049 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6050 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6051 CHOOSEFONT cf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6052 LOGFONT lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6053 char buf[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6054
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6055 bzero (&cf, sizeof (cf));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6056
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6057 cf.lStructSize = sizeof (cf);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6058 cf.hwndOwner = FRAME_W32_WINDOW (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6059 cf.Flags = CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_SCREENFONTS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6060 cf.lpLogFont = &lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6061
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6062 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6063 return Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6064
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6065 return build_string (buf);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6066 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6067
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6068 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
6069 "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
6070 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
6071 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
6072 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
6073 screen saver if defined.\n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6074 \n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6075 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
6076 (command, frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6077 Lisp_Object command, frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6078 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6079 WPARAM code;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6080 FRAME_PTR f = check_x_frame (frame);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6081
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6082 CHECK_NUMBER (command, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6083
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6084 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XINT (command), 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6085
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6086 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6087 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6088
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6089
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6090 syms_of_w32fns ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6091 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6092 /* 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
6093 w32_in_use = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6094
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6095 /* The section below is built by the lisp expression at the top of the file,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6096 just above where these variables are declared. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6097 /*&&& init symbols here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6098 Qauto_raise = intern ("auto-raise");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6099 staticpro (&Qauto_raise);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6100 Qauto_lower = intern ("auto-lower");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6101 staticpro (&Qauto_lower);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6102 Qbackground_color = intern ("background-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6103 staticpro (&Qbackground_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6104 Qbar = intern ("bar");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6105 staticpro (&Qbar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6106 Qborder_color = intern ("border-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6107 staticpro (&Qborder_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6108 Qborder_width = intern ("border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6109 staticpro (&Qborder_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6110 Qbox = intern ("box");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6111 staticpro (&Qbox);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6112 Qcursor_color = intern ("cursor-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6113 staticpro (&Qcursor_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6114 Qcursor_type = intern ("cursor-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6115 staticpro (&Qcursor_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6116 Qforeground_color = intern ("foreground-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6117 staticpro (&Qforeground_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6118 Qgeometry = intern ("geometry");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6119 staticpro (&Qgeometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6120 Qicon_left = intern ("icon-left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6121 staticpro (&Qicon_left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6122 Qicon_top = intern ("icon-top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6123 staticpro (&Qicon_top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6124 Qicon_type = intern ("icon-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6125 staticpro (&Qicon_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6126 Qicon_name = intern ("icon-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6127 staticpro (&Qicon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6128 Qinternal_border_width = intern ("internal-border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6129 staticpro (&Qinternal_border_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6130 Qleft = intern ("left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6131 staticpro (&Qleft);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
6132 Qright = intern ("right");
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
6133 staticpro (&Qright);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6134 Qmouse_color = intern ("mouse-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6135 staticpro (&Qmouse_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6136 Qnone = intern ("none");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6137 staticpro (&Qnone);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6138 Qparent_id = intern ("parent-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6139 staticpro (&Qparent_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6140 Qscroll_bar_width = intern ("scroll-bar-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6141 staticpro (&Qscroll_bar_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6142 Qsuppress_icon = intern ("suppress-icon");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6143 staticpro (&Qsuppress_icon);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6144 Qtop = intern ("top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6145 staticpro (&Qtop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6146 Qundefined_color = intern ("undefined-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6147 staticpro (&Qundefined_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6148 Qvertical_scroll_bars = intern ("vertical-scroll-bars");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6149 staticpro (&Qvertical_scroll_bars);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6150 Qvisibility = intern ("visibility");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6151 staticpro (&Qvisibility);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6152 Qwindow_id = intern ("window-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6153 staticpro (&Qwindow_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6154 Qx_frame_parameter = intern ("x-frame-parameter");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6155 staticpro (&Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6156 Qx_resource_name = intern ("x-resource-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6157 staticpro (&Qx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6158 Quser_position = intern ("user-position");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6159 staticpro (&Quser_position);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6160 Quser_size = intern ("user-size");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6161 staticpro (&Quser_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6162 Qdisplay = intern ("display");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6163 staticpro (&Qdisplay);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6164 /* This is the end of symbol initialization. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6165
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
6166 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
6167 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
6168
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6169 Fput (Qundefined_color, Qerror_conditions,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6170 Fcons (Qundefined_color, Fcons (Qerror, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6171 Fput (Qundefined_color, Qerror_message,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6172 build_string ("Undefined color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6173
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6174 DEFVAR_LISP ("w32-color-map", &Vw32_color_map,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6175 "A array of color name mappings for windows.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6176 Vw32_color_map = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6177
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6178 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
6179 "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
6180 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
6181 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
6182 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
6183
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6184 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
6185 "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
6186 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
6187 Vw32_alt_is_meta = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6188
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6189 DEFVAR_LISP ("w32-pass-optional-keys-to-system",
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6190 &Vw32_pass_optional_keys_to_system,
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
6191 "Non-nil if the 'optional' keys (left window, right window,\n\
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
6192 and application keys) are passed on to Windows.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6193 Vw32_pass_optional_keys_to_system = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6194
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6195 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
6196 "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
6197 Vw32_enable_italics = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6198
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6199 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
6200 "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
6201 Vw32_enable_palette = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6202
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6203 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
6204 &Vw32_mouse_button_tolerance,
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6205 "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
6206 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
6207 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
6208 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
6209 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
6210 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
6211
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6212 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
6213 &Vw32_mouse_move_interval,
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
6214 "Minimum interval between mouse move events.\n\
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
6215 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
6216 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
6217 reported as lisp events.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6218 XSETINT (Vw32_mouse_move_interval, 50);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
6219
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6220 init_x_parm_symbols ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6221
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6222 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
6223 "List of directories to search for bitmap files for w32.");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6224 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6225
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6226 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6227 "The shape of the pointer when over text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6228 Changing the value does not affect existing frames\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6229 unless you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6230 Vx_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6231
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6232 DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6233 "The name Emacs uses to look up resources; for internal use only.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6234 `x-get-resource' uses this as the first component of the instance name\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6235 when requesting resource values.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6236 Emacs initially sets `x-resource-name' to the name under which Emacs\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6237 was invoked, or to the value specified with the `-name' or `-rn'\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6238 switches, if present.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6239 Vx_resource_name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6240
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6241 Vx_nontext_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6242
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6243 Vx_mode_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6244
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6245 DEFVAR_INT ("x-sensitive-text-pointer-shape",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6246 &Vx_sensitive_text_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6247 "The shape of the pointer when over mouse-sensitive text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6248 This variable takes effect when you create a new frame\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6249 or when you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6250 Vx_sensitive_text_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6252 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6253 "A string indicating the foreground color of the cursor box.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6254 Vx_cursor_fore_pixel = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6255
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6256 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6257 "Non-nil if no window manager is in use.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6258 Emacs doesn't try to figure this out; this is always nil\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6259 unless you set it to something else.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6260 /* We don't have any way to find this out, so set it to nil
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6261 and maybe the user would like to set it to t. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6262 Vx_no_window_manager = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6263
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6264 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
6265 &Vx_pixel_size_width_font_regexp,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6266 "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
6267 \n\
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6268 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
6269 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
6270 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
6271 Chinese, Japanese, and Korean.");
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6272 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
6273
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6274 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
6275 &unibyte_display_via_language_environment,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6276 "*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
6277 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
6278 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
6279 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
6280 displayed according to the current fontset.");
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6281 unibyte_display_via_language_environment = 0;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6282
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6283 defsubr (&Sx_get_resource);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6284 defsubr (&Sx_list_fonts);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6285 defsubr (&Sx_display_color_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6286 defsubr (&Sx_display_grayscale_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6287 defsubr (&Sx_color_defined_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6288 defsubr (&Sx_color_values);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6289 defsubr (&Sx_server_max_request_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6290 defsubr (&Sx_server_vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6291 defsubr (&Sx_server_version);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6292 defsubr (&Sx_display_pixel_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6293 defsubr (&Sx_display_pixel_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6294 defsubr (&Sx_display_mm_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6295 defsubr (&Sx_display_mm_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6296 defsubr (&Sx_display_screens);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6297 defsubr (&Sx_display_planes);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6298 defsubr (&Sx_display_color_cells);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6299 defsubr (&Sx_display_visual_class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6300 defsubr (&Sx_display_backing_store);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6301 defsubr (&Sx_display_save_under);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6302 defsubr (&Sx_parse_geometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6303 defsubr (&Sx_create_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6304 defsubr (&Sx_open_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6305 defsubr (&Sx_close_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6306 defsubr (&Sx_display_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6307 defsubr (&Sx_synchronize);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6308
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6309 /* W32 specific functions */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6310
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6311 defsubr (&Sw32_focus_frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6312 defsubr (&Sw32_select_font);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6313 defsubr (&Sw32_define_rgb_color);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6314 defsubr (&Sw32_default_color_map);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6315 defsubr (&Sw32_load_color_file);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6316 defsubr (&Sw32_send_sys_command);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6317
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6318 /* Setting callback functions for fontset handler. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6319 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
6320 list_fonts_func = w32_list_fonts;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6321 load_font_func = w32_load_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6322 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
6323 query_font_func = w32_query_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6324 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
6325 check_window_system_func = check_w32;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6326 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6327
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6328 #undef abort
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6329
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6330 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6331 w32_abort()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6332 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6333 int button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6334 button = MessageBox (NULL,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6335 "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
6336 "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
6337 "Emacs Abort Dialog",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6338 MB_ICONEXCLAMATION | MB_TASKMODAL
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6339 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6340 switch (button)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6341 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6342 case IDRETRY:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6343 DebugBreak ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6344 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6345 case IDIGNORE:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6346 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6347 case IDABORT:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6348 default:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6349 abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6350 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6351 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6352 }
15148
220145cf7546 (continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents: 15147
diff changeset
6353